Carcolour help
#1

When i type

Код:
if(strcmp(cmdtext, "/carcolour", true) == 0)
	{
	new tmp[256];
	new tmp2[256];


	tmp = strtok(cmdtext, idx);
	tmp2 = strtok(cmdtext, idx);

	if(!strlen(tmp))
	{
	SendClientMessage(playerid, 0xAA3333AA ,"Usage: /color [first color ID] [second color ID]");
	}
	else if(!strlen(tmp2))
	{
	ChangeVehicleColor(GetPlayerVehicleID(playerid),strval(tmp),strval(tmp));
	GameTextForPlayer(playerid,"Vehicle color changed",2500,3);
	}
	else if(!IsPlayerInAnyVehicle(playerid))
	{
	SendClientMessage(playerid, 0xAA3333AA ,"You are not in any vehicle!");
	}
	else
	{
	ChangeVehicleColor(GetPlayerVehicleID(playerid),strval(tmp),strval(tmp2));
	GameTextForPlayer(playerid,"Vehicle color changed",2500,3);

	}
	return 1;
I get these erors


Код:
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(579) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(579) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(580) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(580) : error 033: array must be indexed (variable "tmp2")
Reply
#2

Change the arrays sizes to 128 from 256, and strtok is here: https://sampwiki.blast.hk/wiki/Strtok
Reply
#3

I changed

Код:
  if(strcmp(cmdtext, "/carcolour",true) == 0)
	{
	new tmp[128];
	new tmp2[128];
	tmp = strtok(cmdtext, idx);
	tmp2 = strtok(cmdtext, idx);
	if(!strlen(tmp))
	{
	SendClientMessage(playerid, 0xAA3333AA ,"Usage: /color [first color ID] [second color ID]");
	}
	else if(!strlen(tmp2))
	{
	ChangeVehicleColor(GetPlayerVehicleID(playerid),strval(tmp),strval(tmp));
	GameTextForPlayer(playerid,"Vehicle color changed",2500,3);
	}
	else if(!IsPlayerInAnyVehicle(playerid))
	{
	SendClientMessage(playerid, 0xAA3333AA ,"You are not in any vehicle!");
	}
	else
	{
	ChangeVehicleColor(GetPlayerVehicleID(playerid),strval(tmp),strval(tmp2));
	GameTextForPlayer(playerid,"Vehicle color changed",2500,3);
	}
	return 1;
	}
But i still get eror

Код:
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(572) : warning 225: unreachable code
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(576) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(576) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(577) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(577) : error 033: array must be indexed (variable "tmp2")
And i realy dont unerstand this
Код:
strtok

Reply
#4

Just add that stock from the site I gave you, or it's written there as a public, don't remember.
pawn Код:
new cmd[128];
cmd=strtok(cmdtext,idx);
if(!strcmp(cmd,"/carcolour",true))
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xAA3333AA,"You have to be inside a vehicle.");
  cmd=strtok(cmdtext,idx);
  if(!strlen(cmd)) return SendClientMessage(playerid,0xAA3333AA,"usage: /color [first color] [second color]");
  new color1=strval(cmd);
  cmd=strtok(cmdtext,idx);
  if(!strlen(cmd)) return SendClientMessage(playerid,0xAA3333AA,"usage: /color [first color] [second color]");
  ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,strval(cmd));
  GameTextForPlayer(playerid,"Vehicle color changed",2500,3);
  return 1;
}
Reply
#5

Ok iknow i'm boring and i cant script but

Код:
{
	new cmd[128];
	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/carcolour" ,true) == 0)
	{

	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xAA3333AA,"You have to be inside a vehicle.");

	cmd = strtok(cmdtext, idx);

	if(!strlen(cmd)) return SendClientMessage(playerid,0xAA3333AA,"usage: /color [first color] [second color]");

	new color1=strval(cmd);
  cmd = strtok(cmdtext, idx);

	if(!strlen(cmd)) return SendClientMessage(playerid,0xAA3333AA,"usage: /color [first color] [second color]");
  ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,strval(cmd));
  GameTextForPlayer(playerid,"Vehicle color changed",2500,3);
  return 1;
	}
Код:
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(334) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(334) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(341) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(341) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(346) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Stunt-server\gamemodes\StuntWorld.pwn(346) : error 033: array must be indexed (variable "cmd")
Reply
#6

Oh god you gotta be kidding me...
https://sampwiki.blast.hk/wiki/Strtok
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)