28.08.2016, 09:50
PHP код:
AFKTime[playerid] = SetTimer("AFKCheck",1000,1);
PHP код:
public OnGamemodeInit()
{
SetTimer("AFKCheck",1000,1);
}
PHP код:
if(IsAFK[i] == 1) return 0;
PHP код:
public AFKCheck()
{
new Float:x, Float:y, Float:z, string[128];
for (new i, j = GetPlayerPoolSize(); i <= j; i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsAFK[i] == 1) continue;
GetPlayerPos(i,x,y,z);
if(IsPlayerInRangeOfPoint(i,2,x,y,z))
{
AFK[i]++;
}
if(AFK[i] == 300)
{
format(string,sizeof(string),"*%s has gone AFK",GetName(i));//Formats the /do cmd output
SendClientMessageToAll(COLOR_WHITE,string);
IsAFK[i] = 1;
}
}
return 1;
}