SA-MP Forums Archive
Tazer command! - 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: Tazer command! (/showthread.php?tid=149669)



Tazer command! - Antonio [G-RP] - 23.05.2010

So, I have made a tazer command, but when I attempt to use it, it SPAMS 'There is no tazeable player near you'

pawn Код:
if(strcmp(cmd, "/tazer", true) == 0)
{
if(PlayerInfo[playerid][pFaction] != 11)
{
SendClientMessage(playerid, COLOR_RED, "Cops Only!");
return 1;
}
if(tazer[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Your tazer is still recharging!");
return 1;
}
if(tazer[playerid] == 0)
{
SendClientMessage(playerid, COLOR_RED, "Your need a tazer from the PD armoury!");
return 1;
}
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(Suspected[i] == 1)
{
if(GetDistanceBetweenPlayers(playerid, i) < 20)
{
GetPlayerName(i, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s shoots a tazer at %s", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(i, "~r~Tazered", 2500, 3);
tazer[playerid] = 1;
SetTimerEx("Untazer", 20000, false, "i", i);
SetTimerEx("Recharge", 20000, false, "i", playerid);
ApplyAnimation(i, "WUZI", "CS_Dead_Guy", 4.0, 1, 0, 0, 0, 0);
TogglePlayerControllable(i,0);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "There is no tazeable player near you!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "There is no tazeable player near you!");
return 1;
}
}
}
SendClientMessage(playerid, COLOR_RED, "There is no tazeable player near you!");
return 1;
}



Re: Tazer command! - Bayler - 23.05.2010

Your Text Message needs to be OUTSIDE the FOREACH PLAYER Loop.

for (new i = 0; i < MAX_PLAYERS; i++)
{
// Anything in here for text display spams all players
}
SendClientMessage(playerid, COLOR_RED, "There is no tazeable player near you!");


Re: Tazer command! - Antonio [G-RP] - 23.05.2010

Kay, thx