22.09.2012, 22:27
Try using something like this
PHP код:
new afk[MAX_PLAYERS];
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
SetTimer("AFKTimer", 1000, 1);
return 1;
}
forward AFKTimer();
public AFKTimer()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
afk[i]++;
if (afk[i] % 30 == 0)
{
new msg[60];
format(msg, 59, "player %d is afk for %d seconds now!", i, afk[i]);
SendClientMessageToAll(0xFFFFFF00, msg);
}
}
}
}
public OnPlayerUpdate(playerid)
{
afk[playerid] = 0;
return 1;
}