13.11.2014, 04:47
pawn Code:
new AntiAFK[MAX_PLAYERS];
new AFKTIMER[MAX_PLAYERS];
#define MAX_AFK_TIME 5
forward OnPlayerAFKcheck(playerid)
{
AntiAFK[playerid]++;
if(AntiAFK[playerid]>MAX_AFK_TIME)
{
// ur code
//SetPlayerHealth(playerid,0.0);
}
}
public OnPlayerConnect(playerid)
{
AFKTIMER[playerid]=SetTimerEx("OnPlayerAFKcheck",1000,true, "d", playerid);
return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
KillTimer(AFKTIMER[playerid]);
AntiAFK[playerid]=0;
return 1;
}
public OnPlayerUpdate(playerid)
{
AntiAFK[playerid]=0;
return 1;
}