Kick all players? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Kick all players? (
/showthread.php?tid=104931)
Kick all players? -
acade - 26.10.2009
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
Re: Kick all players? -
dice7 - 26.10.2009
pawn Код:
if(strcmp(cmdtext, "/kickall") == 0)
{
for(new id = 0; id < MAX_PLAYERS; id++)
{
if(IsPlayerConnected(id))
{
Kick(id);
}
}
}
Re: Kick all players? -
Anwix - 26.10.2009
Код:
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!)
Re: Kick all players? -
acade - 27.10.2009
Thanks
Re: Kick all players? -
Sergei - 27.10.2009
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.