Server not running properly on host
#4

Use this one

Код:
//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;
}
Add the line for your admins though.
Reply


Messages In This Thread
Server not running properly on host - by lean1337 - 01.03.2015, 23:10
Re: Server not running properly on host - by arakuta - 01.03.2015, 23:34
Re: Server not running properly on host - by lean1337 - 02.03.2015, 01:43
Re: Server not running properly on host - by hamzajaved780 - 02.03.2015, 05:36

Forum Jump:


Users browsing this thread: 3 Guest(s)