SA-MP Forums Archive
error 017: undefined symbol "strtok" - 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)
+--- Thread: error 017: undefined symbol "strtok" (/showthread.php?tid=375389)



error 017: undefined symbol "strtok" - davelord - 06.09.2012

Код:
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1089) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1089) : error 033: array must be indexed (variable "cmd")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1097) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1097) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1150) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1150) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1423) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1423) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1434) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1434) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1467) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1467) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1478) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1478) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1511) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1511) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1581) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1581) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1590) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1590) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1619) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1619) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1655) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1655) : error 033: array must be indexed (variable "tmp")
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1691) : error 017: undefined symbol "strtok"
C:\Users\Mijn pc\Desktop\samptest2\gamemodes\JuliensRoleplay2.pwn(1691) : error 033: array must be indexed (variable "tmp")

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


26 Errors.
Gamemode:

http://pastebin.com/ZnpNNnG5

Help please


Re: error 017: undefined symbol "strtok" - Glint - 06.09.2012

You Need to have the strtok function defined somewhere in your script, so anywhere in your script add this
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;
}