undeffined symbol "idx"
#1

pawn Код:
if(!strcmp("/advertissment", cmdtext, false, 9))
    {
        new tmp[256];
        tmp = strtok ( cmdtext, idx );//Thijs is erreur line.
        new string[128];
        if ( !strlen ( tmp ) )
        {
            SendClientMessage(playerid, COLOR_RED, "/advertissment [Password]");
        }
        else
        {
            format(string, sizeof(string), "%s", cmdtext);
            AdvertissmentForward(string);
        }
        return 1;
    }
Quote:

error 017: undefined symbol "idx"

I'm not sure why it doesn't work, as I never got that erreur in the past..
Help would be appreciated.
-Hamza
Reply
#2

Add:

pawn Код:
new idx;
Reply
#3

This is horrible code.
1. you are comparing the first 9 characters of a string that is 14 characters long
2. you have defined a string 256 characters long to hold a string that you don't even use
3. the string you are displaying the result in is only 128 characters long, and you don't even need it anyway
4. if you are using strtok, idx should already be defined under OnPlayerCommandText
5. idx should already have a value from when you used strtok to get the /advertissment command

pawn Код:
public OnPlayerCOmmandText(playerid,cmdtext[])
{
     new tmp[128],idx;
     tmp = strtok(cmdtext, idx);
     if(!strcmp(tmp,"/advertissment",true))
     {
          tmp = strtok(cmdtext, idx);
          if(!strlen(tmp))
          {
                //message
           }
           AdvertissmentForward(tmp);
     }
     return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)