pawn Код:
#include <a_samp>
#include <foreach>
new Time[MAX_PLAYERS];
public OnFilterScriptInit() //Or OnGameModeInit() if you're using a Game Mode.
{
SetTimer("PlayerTime", 1000, true);
return 1;
}
public OnPlayerConnect(playerid)
{
Time[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Time[playerid] = 0;
return 1;
}
forward PlayerTime();
public PlayerTime()
{
/*for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{ //If you're not using the 'foreach' include.*/
foreach(Player, i)
{
if(Time[i] < 7200)
{
Time[i]++;
}
else
{
SendClientMessage(i, 0xFFFF00FF, "You Have Reached 2 Hours Of Playing Time. Therefore You Have Been Kicked For Reaching The Limit.");
Kick(i);
}
}
return 1;
}
You need to explain why they're getting kicked. You will need the foreach include for this script, otherwise you can use the commented lines as an alternative.