22.04.2010, 13:59
It may be an idea to edit MAX_PLAYERS to the max server slots you have.
Replace this code with the actions you want to take. So if you want to kick them. Use Kick(i);
Код:
#include <a_samp> #define AFK_TIME 30000 new bool:respond[MAX_PLAYERS]; forward CheckAFK(); public OnGameModeInit() { SetTimer("CheckAFK", AFK_TIME, 1); return 1; } public CheckAFK(){ new i = -1; while(++i < MAX_PLAYERS){ if(!IsPlayerConnected(i)) continue; if(respond[i] == false){ // Keel them for being AFK SendClientMessage(i, 0xFFFFFFFF, "You are away from keyboard!"); printf("Playerid %i is AFK", i); } else respond[i] = false; } } public OnPlayerUpdate(playerid) { if(respond[playerid] == false){ respond[playerid] = true; } return 1; }
Код:
SendClientMessage(i, 0xFFFFFFFF, "You are away from keyboard!"); printf("Playerid %i is AFK", i);