error 017: undefined symbol "cmd"
#1

error 017: undefined symbol "cmd"

any help heres my command
pawn Код:
if(strcmp(cmd, "/report", true) == 0)
{
    new str[200];
    GetPlayerName(playerid, str, 24);
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
        idx++;
    }
    new offset = idx;
    new result[96];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
        result[idx - offset] = cmdtext[idx];
        idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /report [text]");
    format(str, sizeof str, "Report from [%d] %s: %s", playerid, str, result);
    for(new i = 0; i < MAX_PLAYERS; i ++) { if(IsPlayerAdmin(i)) SendClientMessage(i, 0xFFFF00FF, str); }
    SendClientMessage(playerid, 0xFFFF00FF, "Your report message was sent to online administrators, thank you.");
    return 1;
}
Reply
#2

replace cmd with cmdtext
Reply
#3

This looks like something from the Godfather. Switch over to a command processor such as ZCMD or YCMD.

pawn Код:
if(strcmp(cmd, "/report", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /report [reason]");
                return 1;
            }
            format(string, sizeof(string), "Report %s: %s", sendername, (result));
            ABroadCast(COLOR_YELLOW,string,1);
            SendClientMessage(playerid, COLOR_YELLOW, "Your report message has been sent to the Admins!");
        }
        return 1;
    }
As quoted from the godfather...
Reply
#4

PHP код:
new cmd[256];
cmd strtok(cmdtextidx);
if(
strcmp(cmd"/report"true) == 0)
{
    new 
str[200];
    
GetPlayerName(playeridstr24);
    new 
length strlen(cmdtext);
    while ((
idx length) && (cmdtext[idx] <= ' '))
    {
        
idx++;
    }
    new 
offset idx;
    new 
result[96];
    while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
    {
        
result[idx offset] = cmdtext[idx];
        
idx++;
    }
    
result[idx offset] = EOS;
    if(!
strlen(result)) return SendClientMessage(playerid0xFFFFFFFF"USAGE: /report [text]");
    
format(strsizeof str"Report from [%d] %s: %s"playeridstrresult);
    for(new 
0MAX_PLAYERS++) { if(IsPlayerAdmin(i)) SendClientMessage(i0xFFFF00FFstr); }
    
SendClientMessage(playerid0xFFFF00FF"Your report message was sent to online administrators, thank you.");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)