SA-MP Forums Archive
announce 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: announce command (/showthread.php?tid=201523)



announce command - Face9000 - 21.12.2010

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


Re: announce command - blackwave - 21.12.2010

Remove the line cmd:

pawn Код:
new cmd[35];

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


Re: announce command - Face9000 - 21.12.2010

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


Re: announce command - blackwave - 21.12.2010

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



Re: announce command - Face9000 - 21.12.2010

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



Re: announce command - iggy1 - 21.12.2010

Try changing "cmd" to cmd1.


Re: announce command - Face9000 - 21.12.2010

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


Re: announce command - blackwave - 21.12.2010

@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


Re: announce command - Face9000 - 21.12.2010

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?


Re: announce command - iggy1 - 21.12.2010

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.