string spamming (+rep) - 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: string spamming (+rep) (
/showthread.php?tid=505841)
string spamming (+rep) -
ChristianIvann09 - 10.04.2014
Hi, Whats wrong with this code?
Код:
CMD:cc(playerid, params[])
{
foreach(Player, i)
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
for(new e = 0; e < 4; e++) ClearChatbox(i);
new broadcast[128];
format(broadcast, sizeof(broadcast), "AdmCMD: Administrator %s has cleared the chat", GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED, broadcast, 1);
}
}
return 1;
}
Its spamming like hell when im executing that command
Re: string spamming (+rep) -
Danijel. - 10.04.2014
pawn Код:
CMD:cc(playerid, params[])
{
if(PlayerInfo[playerid][Admin] >= 1)
{
for(new i; i<100; i++)
{
SendClientMessageToAll(-1, "");
}
new string[128];
format(string, sizeof string, "BLRP | Admin %s cleared chat", GetName(playerid));
SendClientMessageToAll(LIGHTBLUE, string);
}
return 1;
}
Re: string spamming (+rep) -
ChristianIvann09 - 10.04.2014
Quote:
Originally Posted by Danijel.
pawn Код:
CMD:cc(playerid, params[]) { if(PlayerInfo[playerid][Admin] >= 1) { for(new i; i<100; i++) { SendClientMessageToAll(-1, ""); } new string[128]; format(string, sizeof string, "BLRP | Admin %s cleared chat", GetName(playerid)); SendClientMessageToAll(LIGHTBLUE, string); } return 1; }
|
it should be ABroadCast not SendClientMessageToAll
Re: string spamming (+rep) -
RoboN1X - 10.04.2014
Quote:
Originally Posted by Danijel.
pawn Код:
CMD:cc(playerid, params[]) { if(PlayerInfo[playerid][Admin] >= 1) { for(new i; i<100; i++) { SendClientMessageToAll(-1, ""); } new string[128]; format(string, sizeof string, "BLRP | Admin %s cleared chat", GetName(playerid)); SendClientMessageToAll(LIGHTBLUE, string); } return 1; }
|
That will spam for 100 times to all players.
Btw, try this:
pawn Код:
CMD:cc(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
foreach(Player, i)
{
for(new e = 0; e < 4; e++) ClearChatbox(i);
}
new broadcast[128];
format(broadcast, sizeof(broadcast), "AdmCMD: Administrator %s has cleared the chat", GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED, broadcast, 1);
}
return 1;
}
I'm sure "ABroadCast" already have loop to all players on it.
Re: string spamming (+rep) -
ChristianIvann09 - 10.04.2014
Quote:
Originally Posted by Robo_N1X
That will spam for 100 times to all players.
Btw, try this:
pawn Код:
CMD:cc(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2) { foreach(Player, i) { for(new e = 0; e < 4; e++) ClearChatbox(i); } new broadcast[128]; format(broadcast, sizeof(broadcast), "AdmCMD: Administrator %s has cleared the chat", GetPlayerNameEx(playerid)); ABroadCast(COLOR_LIGHTRED, broadcast, 1); } return 1; }
I'm sure "ABroadCast" already have loop to all players on it.
|
Excellent bro +rep