Spam command
#1

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;
}
Reply
#2

Код:
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.
Reply
#3

still give me errors of new errors.
Reply
#4

Which errors then?
Reply
#5

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 
0MAX_PLAYERS++)
    {
        if (
APlayerData[i][PlayerLevel] >= 1)
        {
            
Count ++;
            
GetPlayerName(iAdminMAX_PLAYER_NAME);
            
format(strsizeof str"%s %s",AdminLevelName(i));
            
SendClientMessage(playerid, -1str);
        }
    }
    if(
Count 1SendClientMessage(playerid, -1"No Admin Online!");
    
// Let the server know that this was a valid command
    
return 1;

Reply
#6

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; 
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)