how to define 'tmp' and 'strtok'
#1

hey im getting these errors-

C:\Users\Amanpreet Singh\Desktop\its a server\gamemodes\elitedrift.pwn(530) : error 017: undefined symbol "tmp"
C:\Users\Amanpreet Singh\Desktop\its a server\gamemodes\elitedrift.pwn(530) : error 017: undefined symbol "strtok"
C:\Users\Amanpreet Singh\Desktop\its a server\gamemodes\elitedrift.pwn(531) : error 017: undefined symbol "tmp"
C:\Users\Amanpreet Singh\Desktop\its a server\gamemodes\elitedrift.pwn(532) : error 017: undefined symbol "tmp"
C:\Users\Amanpreet Singh\Desktop\its a server\gamemodes\elitedrift.pwn(533) : error 017: undefined symbol "tmp"
C:\Users\Amanpreet Singh\Desktop\its a server\gamemodes\elitedrift.pwn(533) : error 017: undefined symbol "strtok"
C:\Users\Amanpreet Singh\Desktop\its a server\gamemodes\elitedrift.pwn(534) : error 017: undefined symbol "tmp"
C:\Users\Amanpreet Singh\Desktop\its a server\gamemodes\elitedrift.pwn(535) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.




-----------------

and heres the script that it comes from-


if(strcmp(cmdtext, "/carcolor", true) == 0){
if(IsPlayerInAnyVehicle(playerid))
{
new color1, color2;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /carcolor >color1< >color2<");
color1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /carcolor >color1< >color2<");
color2 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
}
else
{
SendClientMessage(playerid,COLOR_RED,"Your Not in any Vehicle!");
}
return 1;}
Reply
#2

Try adding this somewhere in your 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;
}
Reply
#3

&

pawn Код:
new tmp[128];
on top of the ' OnPlayerCommandText ' callback.
Reply
#4

Quote:
Originally Posted by Serbish
Посмотреть сообщение
&

pawn Код:
new tmp[128];
on top of the ' OnPlayerCommandText ' callback.
Thanks, i forgot that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)