Strtok problem.
#1

I'm currently editing the lvdm.pwn from SAMP and I'm getting a 'strtok' error. To begin with, I honestly haven't touched the strtok code, and this is the error I get.

Код:
C:\Users\User\Desktop\SAMP Scripting\pawno\lvdm.pwn(929) : error 021: symbol already defined: "strtok"
C:\Users\User\Desktop\SAMP Scripting\pawno\lvdm.pwn(944) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
... and ...

This is the line where the error is occurring.

pawn Код:
strtok(const string[], &index)
{ // line 929
    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; // line 944
}
-..

Any concerns why this is actually occurring?
Reply
#2

The function 'strtok' already exists, you do not need to add it again.
Reply
#3

Well, that is the only Strtok function inserted on the script. Anyways, thanks, it works.
Reply
#4

The function is probably already defined in an include that you're using. Includes contain pawn code too.
Reply
#5

Also, I'd recommend using SSCANF instead of strtok, because strtok is: old, slow, outdated.
Reply
#6

His problem was solved, recommending a more efficient method is irrelevant to the topic at hand.

Plus you have practically no idea of what you're talking about and probably wouldn't even be able to point out how to indicate speed differences between the two functions.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)