Kick all CMD - 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)
+--- Thread: Kick all CMD (
/showthread.php?tid=296311)
Kick all CMD -
DaRkAnGeL[NBK] - 10.11.2011
Hey,
How can i make a kickall command that only kicks non admin players?
Thanks inadvance
Re: Kick all CMD -
grand.Theft.Otto - 10.11.2011
Untested:
pawn Код:
if(!strcmp(cmdtext, "/kickall", true, 8))
{
for(new i = 0; i < MAX_PLAYERS; i++))
{
if(!IsPlayerAdmin(i))
{
if(IsPlayerConnected(i))
{
SendClientMessageToAll(-1,"All Players Have Been Kicked From The Server By An Admin.");
Kick(i);
return 1;
} else return SendClientMessage(playerid,-1,"There Are No Players Connected.");
}
}
}
Re: Kick all CMD -
knackworst - 10.11.2011
pawn Код:
if(!strcmp("/kickall", cmdtext, true))
{
for(new i; i < MAX_PLAYERS; i++)
{
if(pInfo[i][pLevel] < 1)
{
if(IsPlayerConnected(i))
{
Kick(i);
}
}
}
return 1;
}
very simple and easy, you cann add some more stuff like messages and stuff...
just remmeber that after the loop and after the pLevel if statment i represents every player that hasn't got an admin level.
also change the pLevel array into the array that u use for your admin level
EDIT: damn u poster above!, like ur name btw
Re: Kick all CMD -
DaRkAnGeL[NBK] - 10.11.2011
Thank you
Re: Kick all CMD -
Norn - 10.11.2011
You people check if the person is an administrator before even checking if the person is connected, pointless.
Plus that Otto guys code will break the loop if one player isn't connected.