CMD:bk spamming. - 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: CMD:bk spamming. (
/showthread.php?tid=563750)
CMD:bk spamming. -
fonia5 - 16.02.2015
Whenever i type in the command it keeps on spamming the screen also it's saying that my location is at blueberry when am at LS airport docks any help with it?
Code:
new ICBK[MAX_PLAYERS] = 0;
CMD:bk(playerid, i, params[])
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "You are not a police officer.");
if(ICBK[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA,"You need to wait 1 minute before calling backup again!"); // Message if player will want to spam backup..
new fX, fY, fZ;
ICBK[playerid] = 1; // Is calling backup, so player won't be able to spam it
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (GetFactionType(i) == FACTION_POLICE)
{
SendFactionMessage(PlayerData[playerid][pFaction], COLOR_RADIO, "RADIO: ALL UNITS! %s is requesting immediate assistance, his location has been located on radar! at %s.", ReturnName(playerid, 0), GetLocation(fX, fY, fZ));
SetPlayerMarkerForPlayer(i, playerid, 0xC2A2DAAA); // it will set purple marker on player whoever called backup and only cops will be able to see it
SetTimerEx("RemoveMarker", 60000, true, "i",playerid); // We will set 1 min timer to auto remove marker
}
}
return 1;
}
forward RemoveMarker(playerid);
public RemoveMarker(playerid)
{
ICBK[playerid] = 0;
SetPlayerMarkerForPlayer(00, 00, 00); // Removing marker
SendClientMessage(playerid,0xC2A2DAAA,"You have been unmarked from Police Radar, if you still need backup use /bk");
return 1;
}
Re: CMD:bk spamming. -
Vince - 16.02.2015
FactionMessage (which probably contains a loop itself) and the timer should not be within the loop body.
Re: CMD:bk spamming. -
Jimmy0wns - 16.02.2015
pawn Code:
if (GetFactionType(i) == FACTION_POLICE)
{
SendFactionMessage(PlayerData[playerid][pFaction], COLOR_RADIO, "RADIO: ALL UNITS! %s is requesting immediate assistance, his location has been located on radar! at %s.", ReturnName(playerid, 0), GetLocation(fX, fY, fZ));
SetPlayerMarkerForPlayer(i, playerid, 0xC2A2DAAA); // it will set purple marker on player whoever called backup and only cops will be able to see it
SetTimerEx("RemoveMarker", 60000, true, "i",playerid); // We will set 1 min timer to auto remove marker
break;
}
Re: CMD:bk spamming. -
xVIP3Rx - 16.02.2015
Show the SendFactionMessage itself, should be like
Re: CMD:bk spamming. -
The__ - 17.02.2015
pawn Code:
CMD:bk(playerid, i, params[])
{
new fX, fY, fZ;
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "You are not a police officer.");
if(ICBK[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA,"You need to wait 1 minute before calling backup again!");
SendFactionMessage(PlayerData[playerid][pFaction], COLOR_RADIO, "RADIO: ALL UNITS! %s is requesting immediate assistance, his location has been located on radar! at %s.", ReturnName(playerid, 0), GetLocation(fX, fY, fZ));
SetPlayerMarkerForPlayer(i, playerid, 0xC2A2DAAA);
ICBK[playerid] = 1;
return 1;
}
Not sure why you were running a loop through all players though honestly.