27.05.2010, 01:09
Код:
forward CheckAFK();
public CheckAFK()
{
new string[50];
new Float:x,Float:y,Float:z;
for(new i,g=GetMaxPlayers(); i < g; i++) if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
GetPlayerPos(i,x,y,z);
if(x == PPos[i][0] && y == PPos[i][1] && z == PPos[i][2])
{
AFKMins[i]++;
if(AFKMins[i] >= AFKTime)
{
if(AFK[i] == 0)
{
AFK[i] = 1;
TogglePlayerControllable(i,0);
SetPlayerColor(i,COLOR_GREY);
oldworld[i] = GetPlayerVirtualWorld(i);
SetPlayerVirtualWorld(i,10);
format(string,sizeof(string),"[ ! ] %s is now in AFK mode!",GetName(i));
SendClientMessageToAll(COLOR_GREY,string);
}
}
}else{
PPos[i][0] = x;
PPos[i][1] = y;
PPos[i][2] = z;
}
}
return 1;
}
