SA-MP Forums Archive
error 017: undefined symbol "cmd" - 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: error 017: undefined symbol "cmd" (/showthread.php?tid=268494)



error 017: undefined symbol "cmd" - phil_lendon - 12.07.2011

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



Re: error 017: undefined symbol "cmd" - Roko_foko - 12.07.2011

replace cmd with cmdtext


Re: error 017: undefined symbol "cmd" - Kush - 12.07.2011

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...


Re: error 017: undefined symbol "cmd" - Shadoww5 - 12.07.2011

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;