SA-MP Forums Archive
Alot of Strtok errors - 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: Alot of Strtok errors (/showthread.php?tid=146418)



Alot of Strtok errors - sekol - 07.05.2010

So i downloaded a car system in my own language, theres a command /pojazd otworz which opens a car, when i change "otworz" to "open" or to anything else i get those errors
Код:
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1319) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1319) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1343) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1343) : error 033: array must be indexed (variable "x_nr")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1360) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1360) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1378) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1378) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1599) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1599) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1735) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1735) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1748) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1748) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1798) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1798) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1872) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1872) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2036) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2036) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2053) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2053) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2409) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2409) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2586) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2586) : error 033: array must be indexed (variable "tmp")

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


26 Errors.
How to fix these errors? Maybe its something like "anty-changecredits" which blocks me from compiling?


Re: Alot of Strtok errors - luigifan9 - 07.05.2010

Quote:
Originally Posted by sekol
So i downloaded a car system in my own language, theres a command /pojazd otworz which opens a car, when i change "otworz" to "open" or to anything else i get those errors
Код:
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1319) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1319) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1343) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1343) : error 033: array must be indexed (variable "x_nr")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1360) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1360) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1378) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1378) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1599) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1599) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1735) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1735) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1748) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1748) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1798) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1798) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1872) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(1872) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2036) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2036) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2053) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2053) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2409) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2409) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2586) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(2586) : error 033: array must be indexed (variable "tmp")

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


26 Errors.
How to fix these errors? Maybe its something like "anty-changecredits" which blocks me from compiling?
[pawno]
#include <a_samp>
[/pawno]

Did you do that?


Re: Alot of Strtok errors - iggy1 - 07.05.2010

have you added this at the top of ur script?

Код:
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;
}
edit:not right at the top*



Re: Alot of Strtok errors - sekol - 07.05.2010

Quote:
Originally Posted by iggy1
have you added this at the top of ur script?

Код:
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;
}
At top? Under public or something?


Re: Alot of Strtok errors - iggy1 - 07.05.2010

i had it after onfilterscriptinit only used it once now i use zcmd and sscanf

Edit: not inside OnFilterScriptInit after the closing brace (im no expert)


Re: Alot of Strtok errors - sekol - 07.05.2010

Now I'm gettin' this:
Код:
 C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(735) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(735) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(735) : error 017: undefined symbol "string"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(735) : fatal error 107: too many error messages on one line

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


4 Errors.



Re: Alot of Strtok errors - dice7 - 07.05.2010

put this function on the very bottom of 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: Alot of Strtok errors - sekol - 07.05.2010

Now this
Код:
 C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(810) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(810) : error 017: undefined symbol "string"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(810) : error 017: undefined symbol "index"
C:\Documents and Settings\Machlik\Pulpit\CRP_0.3\SA-MP\filterscripts\pojazdy.pwn(810) : fatal error 107: too many error messages on one line

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


4 Errors.



Re: Alot of Strtok errors - dice7 - 07.05.2010

Show the lines


Re: Alot of Strtok errors - sekol - 07.05.2010

Код:
Код:
From 790 to 820
AddMenuItem(ColorsS, 0, "Blue");
AddMenuItem(ColorsS, 0, "Grey");
AddMenuItem(ColorsS, 0, "Light red");
AddMenuItem(ColorsS, 0, "Light Green");
AddMenuItem(ColorsS, 0, "Purple");

Colors2S = CreateMenu("Vehicle Colors Two", 1, 50.0, 180.0, 200.0, 200.0);

AddMenuItem(Colors2S, 0, "Black");
AddMenuItem(Colors2S, 0, "White");
AddMenuItem(Colors2S, 0, "Light Blue");
AddMenuItem(Colors2S, 0, "Red");
AddMenuItem(Colors2S, 0, "Green");
AddMenuItem(Colors2S, 0, "Pink");
AddMenuItem(Colors2S, 0, "Yellow");
AddMenuItem(Colors2S, 0, "Blue");
AddMenuItem(Colors2S, 0, "Grey");
AddMenuItem(Colors2S, 0, "Light red");
AddMenuItem(Colors2S, 0, "Light Green");
AddMenuItem(Colors2S, 0, "Purple");
strtok(const string[], &index) *LINE 810*
{
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)))
{