Kick all Plz Help - 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 Plz Help (
/showthread.php?tid=551221)
Kick all Plz Help -
Airblog - 17.12.2014
Hi All
i need a Cmd That it gives me to kick all the players
Plz Give it Plz
it is my /kick code that kick just 1 player how can i make it for all the players?
Код:
CMD:kick(playerid, params[])
{
new playerb, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Aval Bayad login Koni Ghabl Az inke Az CMD Ha Estefade Koni.");
if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pHelper] < 1) return SendClientMessage(playerid, COLOR_GREY, "Shoma Sath Dast Resi Be In CMD Ra Nadarid.");
// if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
if(sscanf(params, "us[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");
if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "ID Bazikon Vared Shode Eshtebah Ast.");
if(IsPlayerNPC(playerb)) return SendClientMessage(playerid, COLOR_GREY, "You can't kick NPCs out of the server.");
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[playerb][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
format(string, sizeof(string), "{FF0000}[Admin]{FF6347} %s has been kicked by %s, reason: %s", NORPN(playerb), NORPN(playerid), params);
SendClientMessageToAll(COLOR_LIGHTRED, string);
format(string, sizeof(string), "{FF0000}[Admin]{FF6347} %s has been kicked by %s (%s), reason: %s", NORPN(playerb), NORPN(playerid), RPIP(playerid), params);
Log("logs/kick.log", string);
// Textdraw
TextDrawShowForPlayer(playerb, KickedNotice);
// Kick Action
FixedKick(playerb);
return 1;
}
Re: Kick all Plz Help -
JeaSon - 17.12.2014
use a loop for that
pawn Код:
for(new i; i < MAX_PLAYERS; ++i)
{
}
pawn Код:
CMD:kickall(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Aval Bayad login Koni Ghabl Az inke Az CMD Ha Estefade Koni.");
for(new i = 0; i < MAX_PLAYERS; i++))
{
if(PlayerInfo[playerid][pAdmin] >= 5) // note that this command can only be done by admin level 5+
{
if(IsPlayerConnected(i))
{
if(sscanf(params, "s[128]",params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kickall [reason]");
format(string, sizeof(string), "{FF0000}[Admin]{FF6347} All Players has been kicked by %s, reason: %s", NORPN(playerb), NORPN(playerid), params);
SendClientMessageToAll(COLOR_LIGHTRED, string);
format(string, sizeof(string), "{FF0000}[Admin]{FF6347} All Players has been kicked by %s (%s), reason: %s", NORPN(playerb), NORPN(playerid), RPIP(playerid), params);
Log("logs/kick.log", string);
FixedKick(i);
} else return SendClientMessage(playerid,-1,"There Are No Players Connected.");
}
}
return 1;
}
Re: Kick all Plz Help -
Threshold - 18.12.2014
Quote:
Originally Posted by Namer
use a loop for that
|
You are correct, but creating your own code isn't going to help. When did he ask for it to be restricted to level 5 admins? You removed the NPC check and the admin check to make sure he wasn't kicking those.
pawn Код:
CMD:kickall(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Aval Bayad login Koni Ghabl Az inke Az CMD Ha Estefade Koni.");
if(!PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pHelper]) return 1;
new reason[60];
if(sscanf(params, "s[60]", reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kickall [reason]");
new string[128];
format(string, sizeof(string), "[Admin]{FF6347} All Players have been kicked by %s, reason: %s", NORPN(playerid), reason);
SendClientMessageToAll(COLOR_LIGHTRED, string);
format(string, sizeof(string), "[Admin]{FF6347} All Players have been kicked by %s (%s), reason: %s", NORPN(playerid), RPIP(playerid), reason);
Log("logs/kick.log", string);
for(new i = 0; i < MAX_PLAYERS; i++))
{
if(!IsPlayerConnected(i) || i == playerid || IsPlayerNPC(i)) continue;
if(PlayerInfo[i][pAdmin] > PlayerInfo[playerid][pAdmin]) continue;
TextDrawShowForPlayer(i, KickedNotice);
FixedKick(i);
}
return 1;
}