Cop backup showing for EVERYONE? - 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: Cop backup showing for EVERYONE? (
/showthread.php?tid=428511)
Cop backup showing for EVERYONE? -
MrSnapp - 06.04.2013
Even with IsACop it is still showing the whole server...
pawn Код:
CMD:bk(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD Officer.");
new string[256];
foreach(Player, i)
{
if(IsACop(playerid))
{
format(string, sizeof(string), "[Police Message] %s has activated their assistance beacon, please respond immediately.", RPN(playerid));
SendClientMessage(i, COLOR_GREEN, string);
SetPlayerMarkerForPlayer(playerid, i, COLOR_BLUE);
}
}
return 1;
}
CMD:bkc(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD Officer.");
new string[128];
foreach(Player, i)
{
if(IsACop(playerid))
{
format(string, sizeof(string), "[Police Message] %s has deactivated their assistance beacon. Code 4.", RPN(playerid));
SendClientMessage(i, COLOR_GREEN, string);
SetPlayerMarkerForPlayer(i, playerid, TEAM_HIT_COLOR);
}
}
return 1;
}
Re: Cop backup showing for EVERYONE? -
Pottus - 06.04.2013
Don't see the mistake look here.
Код:
foreach(Player, i)
{
if(IsACop(i))
Re: Cop backup showing for EVERYONE? -
Face9000 - 06.04.2013
Why are you using foreach (a loop) if, i bet, IsACop as already a loop for cop team? Remove it.