announce command
#1

Ok i've the announce command,but i've a strange error:

Код:
error 021: symbol already defined: "cmd"
Code:

pawn Код:
new sendername[24];
        new cmd[35];
        new idx;
        new tmp[35];
        if(strcmp(cmd, "/ann", true) == 0)
    {
     if(PlayerInfo[playerid][AdminLevel] > 2)
    {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new result[128];
            result = bigstrtok(cmdtext, idx);
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /ann [message] [time in seconds(if non entered, 5 seconds will be the time by default)]");
                return 1;
            }
            new timexx;
            tmp = strtok(cmdtext, idx);
            if (!strlen(tmp)) timexx = 5;
            else timexx = strval(tmp);
            new string[128];
            format(string, sizeof(string), "~w~%s", result);
            new str[128];
            format(str,sizeof str,"0,13INGAME announce from %s : %s",(sendername), result);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
            GameTextForAll(string, timexx*1000, 4);
            printf("%s", string);
        }
        else SendClientMessage(playerid, COLOR_RED, "You cannot use this command!");
        return 1;
    }
If i remove the cmd,i got "Undefenied symbol"..wtf...
Reply
#2

Remove the line cmd:

pawn Код:
new cmd[35];

Always I'd suggest you to use dcmd + sscanf, or normally dcmd
Reply
#3

Emh,if i remove that line,i will get "undefinied symbol cmd"
Reply
#4

Add:
pawn Код:
new cmd[35]; cmd = strtok(cmdtext, index);
Reply
#5

Код:
 error 017: undefined symbol "index"
 error 021: symbol already defined: "cmd"
Reply
#6

Try changing "cmd" to cmd1.
Reply
#7

I'm sure if i will change it,pawno will return me "symbol is assigned a value that is never used"
Reply
#8

@login: really, your errors are the most weirdest ones... And if there were any simbols already defined, would give a warning, not an error.. Maybe some include you added. Or a global string
Reply
#9

I have a custom registration system.Before the cmd /register i've this:

Код:
    new cmd[256], idx, file[128], tmp[256], tmp2[256];
    cmd = strtok(cmdtext, idx);
Maybe it's for this?
Reply
#10

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
I'm sure if i will change it,pawno will return me "symbol is assigned a value that is never used"
If thats so then you never use the variable in the first place.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)