SA-MP Forums Archive
Defining - 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: Defining (/showthread.php?tid=138269)



Defining - Packer5 - 01.04.2010

Hey

Quote:

undefined symbol "strtok"

How would I go about defining strtok ?


Re: Defining - Last_Stand_Guardian - 01.04.2010

Put this in your script:

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}



Re: Defining - Packer5 - 01.04.2010

thanks for the reply,

do I need to do the same for idx?

Код:
undefined symbol "idx"



Re: Defining - Last_Stand_Guardian - 01.04.2010

pawn Код:
new idx;
xD ^^


Re: Defining - Packer5 - 01.04.2010

Aw!
I fail!

Thanks man, it works great now


Re: Defining - RSX - 01.04.2010

Have you installed commands whitch requires strtok and variables, don't mind posting OnPlayerCommandText then, so that you don't do something wrong.
Sorry, but i just want to know .


Re: Defining - Packer5 - 01.04.2010

the whole thing?


Re: Defining - Last_Stand_Guardian - 01.04.2010

If you have so much, just say us if you have commands like:

if(strcmp(cmd, "/command", true) == 0)

=D


Re: Defining - RSX - 01.04.2010

Whole function OnPlayerCommandText if you don't mind, i will scrool it thought rapidly.