14.07.2015, 09:39
I would do something like this
OnPlayerUpdate is called very often and the timer at the end will set your player back to AFK 2 seconds after it is last called. I haven't tested this myself but hopefully when the player tabs out, the timer will still get called and they will still be set to AFK because OnPlayerUpdate is not called to set them back to not AFK as they are tabbed out.
Код:
forward AFKToggle(playerid); public AFKToggle(playerid) { PlayerInfo[playerid][AFK] = 1; } public OnPlayerUpdate(playerid) { PlayerInfo[playerid][AFK] = 0; //// YOUR CODE HERE SetTimerEx("AFKToggle", 2000, false, "i", playerid); }