Ко всем new:
В OnGameModeInit:PHP код:
const MAX_AFK_TIME = 10*60; // макс. время в AFK - 10 минут
new afk_time[MAX_PLAYERS];
new Float:afk_pos[MAX_PLAYERS][3];
В OnPlayerConnect:PHP код:
SetTimer("AFKCheck",1000,1);
В конец скрипта:PHP код:
afk_time[playerid] = 0;
Автор: Pro-Pawn TeamPHP код:
forward AFKCheck();
public AFKCheck()
{
static const str[] = " кикнут за АФК.";
new string[MAX_PLAYER_NAME+sizeof(str)];
new Float:x, Float:y, Float:z;
foreach(new i:Player)
{
GetPlayerPos(i, x, y, z);
if(IsPlayerInRangeOfPoint(i, 2.0, afk_pos[i][0], afk_pos[i][1], afk_pos[i][2]))
{
if(++afk_time[i] == MAX_AFK_TIME)
{
GetPlayerName(i, string, sizeof(string));
strcat(string, str);
SendClientMessageToAll(-1, string);
Kick(i);
}
}
else
afk_time[i] = 0;
afk_pos[i][0] = x, afk_pos[i][1] = y, afk_pos[i][2] = z;
}
return 1;
}