Originally Posted by BenzoAMG
pawn Code:
public OnPlayerSpawn(playerid) { SetTimerEx("AFKCheck", 300000, false, "i", playerid); return 1; }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { KillTimer(AFKCheck(playerid)); SetTimerEx("AFKCheck", 300000, false, "i", playerid); return 1; }
public OnPlayerText(playerid, text[]) { KillTimer(AFKCheck(playerid)); SetTimerEx("AFKCheck", 300000, false, "i", playerid); return 1; }
public OnPlayerCommandText(playerid, cmdtext[]) { KillTimer(AFKCheck(playerid)); SetTimerEx("AFKCheck", 300000, false, "i", playerid); return 1; }
forward AFKCheck(playerid); public AFKCheck(playerid) { new string[80]; format(string, sizeof(string), "Player %s has been kicked | Reason: Away From Keyboard", playername); SendClientMessageToAll(0xFF0000FF, string); Kick(playerid); return 1; }
Basically, the code above, sets a timer for 5 minutes, and whenever the player does something like move, type a command or speak, the timer will reset.
|