Kick all players?
#1

Hello, Is there a way that I can kick all players without typing /kick all the time? I'm looking for the bit of code I need to put in
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/kickall") == 0)
{
  for(new id = 0; id < MAX_PLAYERS; id++)
  {
    if(IsPlayerConnected(id))
    {
      Kick(id);
    }
  }
}
Reply
#3

Код:
dcmd_kickall(playerid, params[])
{
	if (IsPlayerAdmin(playerid))
	{
		for (new i = 0; i < MAX_PLAYERS; i++)
		{
			if (IsPlayerConnected(i) && !IsPlayerAdmin(i))
			{
				Kick(i);
			}
		}
	}
}
Untested. (This will kick all players who are not admins!)
Reply
#4

Thanks
Reply
#5

pawn Код:
ZCMD:kickall(playerid,params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid)
    {
        foreach(Player,i)
        {
            if(!IsPlayerAdmin(i)) Kick(i);
        }
    }
    return 1;
}
Example with using zcmd and foreach; currently the best possible option.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)