02.03.2015, 05:36
Use this one
Add the line for your admins though.
Код:
//On the top of your script new AFK[MAX_PLAYERS]; new AFKTime[MAX_PLAYERS]; OnPlayerConnect(playerid) { AFKTime[playerid] = SetTimer("AFKCheck",1000,1); } forward AFKCheck(); public AFKCheck() { new Float:Pos[3]; // creating an array variable of 3 values whose datatype is Float. for(new i = 0; i < MAX_PLAYERS; i++) // Looping through the players. { GetPlayerPos(i,Pos[0],Pos[1],Pos[2]); // Gets the player position and saves into their variables. if(IsPlayerInRangeOfPoint(i,2,Pos[0],Pos[1],Pos[2])) // If player is around the position (if player is at the same place) { AFK[i]++; // Increment the AFK variable (for every second if player is at same location, increase the AFK variable by 1) } if(AFK[i] == 60) // If it has been a minute for the player being at the same place { AFK[i] = 0; // Reset the afk variable format(string,sizeof(string),"%s has been auto-kicked for inactivity.",pName(i)); SendClientMessageToAll(COLOR_WHITE,string); Kick(playerid); //Kick the player. } } return 1; } public OnPlayerUpdate(playerid) { AFK[playerid] = 0; return 1; }