Strtok problem
#1

i using godfather but now i have these errors:

Код:
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(19197) : error 021: symbol already defined: "split"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(20351) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(20351) : error 033: array must be indexed (variable "tmp2")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(20351) : warning 203: symbol is never used: "Index"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(21861) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(21861) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22070) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22070) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22177) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22177) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22294) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22294) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22406) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22406) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22787) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22787) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22858) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22858) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22962) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(22962) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(23710) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(23710) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(23896) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(23896) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(23918) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(23918) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Toni Tomas\Desktop\faktion\gamemodes\bedi.pwn(23926) : error 017: undefined symbol "strtok"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#2

put this with your stock's
pawn Код:
stock split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc)){
        if(strsrc[i]==delimiter || i==strlen(strsrc)){
            len = strmid(strdest[aNum], strsrc, li, i, 128);
            strdest[aNum][len] = 0;
            li = i+1;
            aNum++;
        }
        i++;
    }
    return 1;
}
and you don't have define strtok https://sampwiki.blast.hk/wiki/Strtok
here it is:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)