Erorrs "strtok"
#1

Recently I started to learn scripting.
I have a gamemode to start , but I have some errors :
This Errors:
Quote:

D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24632) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24632) : error 033: array must be indexed (variable "cmd")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24641) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24641) : error 033: array must be indexed (variable "x_nr")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24733) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24733) : error 033: array must be indexed (variable "x_nr")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24765) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24765) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24773) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24773) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24821) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24821) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24854) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24854) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24902) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24902) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24942) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24942) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24982) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(24982) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(25052) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(25052) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(25241) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(25241) : error 033: array must be indexed (variable "tmp")
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(25302) : error 017: undefined symbol "strtok"
D:\Documents and Settings\c0sminX\Desktop\samp03x_svr_R1-2_win32\gamemodes\v6.1.pwn(25302) : error 033: array must be indexed (variable "tmp")

I search on ****** and find this :
Код:
strtok(const stringstrtok[], &index)
{
	new length = strlen(stringstrtok);
	while ((index < length) && (stringstrtok[index] <= ' ')) { index++; }

	new offset = index, result[20];
	while ((index < length) && (stringstrtok[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = stringstrtok[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
But if I put this in gamemode , The spawn is elsewhere , I fall , The teleport's dosen't work and money is on 0 and can't set money.

I wait for an answer.
Thanks a lot! ^^
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=120356

I'm curious as to why new scripters always want to start with the oldest and most obsolete methods.
Reply
#3

I can't understand. I download files from : https://sampforum.blast.hk/showthread.php?tid=120356 , but I have the same errors. I need to put this in GameMode : strtok(const stringstrtok[], &index)
{
new length = strlen(stringstrtok);
while ((index < length) && (stringstrtok[index] <= ' ')) { index++; }

new offset = index, result[20];
while ((index < length) && (stringstrtok[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = stringstrtok[index];
index++;
}
result[index - offset] = EOS;
return result;
}
??
Reply
#4

Cosmin, Vince try to say you should use sscanf instead of strtok
Anyway, learn strtok from here: https://sampwiki.blast.hk/wiki/Strtok
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)