Spam 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)
+--- Thread: Spam command (
/showthread.php?tid=436768)
Spam command -
DerickClark - 12.05.2013
if i /sethelper
i do /helpers
it spam command like:
Helper Test
Helper Test
Helper Test
helper Test
Helper Test
Command
Код:
CMD:helpers(playerid, params[])
{
new count = 0, str[40], name[MAX_PLAYER_NAME+1];
SendClientMessage(playerid, -1, "Helpers Online:");
for(new i; i<MAX_PLAYERS; i++)
{
if(APlayerData[playerid][PlayerHelper])
{
GetPlayerName(i, name, sizeof name);
format(str, sizeof str, "Helper %s", name);
SendClientMessage(playerid, -1, str);
count ++;
}
}
if(count == 0) SendClientMessage(playerid, -1, "There are no helpers online at the moment.");
// Let the server know that this was a valid command
return 1;
}
AW: Spam command -
Blackazur - 12.05.2013
Код:
CMD:helpers(playerid, params[])
{
new count = 0, str[40], name[MAX_PLAYER_NAME+1];
SendClientMessage(playerid, -1, "Helpers Online:");
if(APlayerData[playerid][PlayerHelper])
{
GetPlayerName(i, name, sizeof name);
format(str, sizeof str, "Helper %s", name);
SendClientMessage(playerid, -1, str);
count ++;
}
if(count == 0) SendClientMessage(playerid, -1, "There are no helpers online at the moment.");
// Let the server know that this was a valid command
return 1;
}
just remove the for(new loop.
Re: Spam command -
DerickClark - 12.05.2013
still give me errors of new errors.
AW: Spam command -
Blackazur - 12.05.2013
Which errors then?
Re: Spam command -
DerickClark - 12.05.2013
error 017: undefined symbol "i"
warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
my /admins work. not the /helper don't work keep spaming
Here my /admins command:
PHP код:
// This command lists all online admins
CMD:admins(playerid)
{
new Count;
new str[45], Admin[MAX_PLAYER_NAME];
SendClientMessage(playerid, -1, "Administrators online:");
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if (APlayerData[i][PlayerLevel] >= 1)
{
Count ++;
GetPlayerName(i, Admin, MAX_PLAYER_NAME);
format(str, sizeof str, "%s %s",Admin, LevelName(i));
SendClientMessage(playerid, -1, str);
}
}
if(Count < 1) SendClientMessage(playerid, -1, "No Admin Online!");
// Let the server know that this was a valid command
return 1;
}
AW: Spam command -
Blackazur - 12.05.2013
By the /helpers command just write playerid and not i by GetPlayerName.
And for /admins try that:
Код:
CMD:admins(playerid)
{
new Count;
new str[45], Admin[MAX_PLAYER_NAME];
SendClientMessage(playerid, -1, "Administrators online:");
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if (APlayerData[i][PlayerLevel] >= 1)
{
Count ++;
GetPlayerName(i, Admin, MAX_PLAYER_NAME);
format(str, sizeof str, "%s %s",Admin, LevelName(i));
SendClientMessage(playerid, -1, str);
}
}
if(Count < 1) SendClientMessage(playerid, -1, "No Admin Online!");
// Let the server know that this was a valid command
return 1;
}