SA-MP Forums Archive
Undefined symbol problem!? - 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: Undefined symbol problem!? (/showthread.php?tid=411831)



Undefined symbol problem!? PLEASE CHECK! - LuckyPlaya` - 30.01.2013

Here are the errors

Код:
D:\Users\ROBERT\Desktop\AVS.pwn(1761) : warning 225: unreachable code
D:\Users\ROBERT\Desktop\AVS.pwn(1761) : error 017: undefined symbol "cmd"
D:\Users\ROBERT\Desktop\AVS.pwn(1762) : error 029: invalid expression, assumed zero
D:\Users\ROBERT\Desktop\AVS.pwn(1762) : warning 217: loose indentation
D:\Users\ROBERT\Desktop\AVS.pwn(1762) : error 029: invalid expression, assumed zero
D:\Users\ROBERT\Desktop\AVS.pwn(1763) : error 029: invalid expression, assumed zero
D:\Users\ROBERT\Desktop\AVS.pwn(1763) : error 029: invalid expression, assumed zero
D:\Users\ROBERT\Desktop\AVS.pwn(1763) : error 029: invalid expression, assumed zero
D:\Users\ROBERT\Desktop\AVS.pwn(1763) : fatal error 107: too many error messages on one line
Код:
if(strcmp(cmd,"/car",true)==0)
{
                if(IsPlayerConnected(playerid))
                {
                        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You are not driving a vehicle!");
			new vehicleid = GetPlayerVehicleID(playerid);
			if(IsBicycle(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "You are not driving a vehicle!");
			new id = GetVehicleID(vehicleid);
			if(GetPlayerVehicleAccess(playerid, id) < 1) return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
			SetPVarInt(playerid, "DialogValue1", id);
			ShowDialog(playerid, DIALOG_VEHICLE);
			new carpart[64];
			carpart = strtok(cmdtext, idx);
			if(!strlen(carpart))
			{
                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /car [name]");
                        SendClientMessage(playerid, COLOR_GREY, "Available names: Engine, Lights, Hood, Trunk, FillTank");
                        return 1;
                        }
                        else if(strcmp(carpart,"engine",true) == 0)
                        {
				new vehicleid = GetPlayerVehicleID(playerid);
				new engine, lights, alarm, doors, bonnet, boot, objective;
				GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
				if(engine == 0 && Fuel[vehicleid] <= 0)
				{
					ShowErrorDialog(playerid, "This vehicle is out of fuel!");
					return 1;
				}
				if(engine == 1) { engine = 0; lights = 0; }
				else { engine = 1; lights = 1; }
				SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
			}
			else if(strcmp(carpart,"lights",true) == 0)
                        {
				new vehicleid = GetPlayerVehicleID(playerid);
				new engine, lights, alarm, doors, bonnet, boot, objective;
				GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
				if(lights == 1) lights = 0; else lights = 1;
				SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
			}
			else if(strcmp(carpart,"hood",true) == 0)
                        {
				new vehicleid = GetPlayerVehicleID(playerid);
				new engine, lights, alarm, doors, bonnet, boot, objective;
				GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
				if(bonnet == 1) bonnet = 0; else bonnet = 1;
				SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
			}
			else if(strcmp(carpart,"trunk",true) == 0)
                        {
				new vehicleid = GetPlayerVehicleID(playerid);
				new engine, lights, alarm, doors, bonnet, boot, objective;
				GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
				if(boot == 1) boot = 0; else boot = 1;
				SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
			}
			else if(strcmp(carpart,"filltank",true) == 0)
                        {
				if(!GetPVarInt(playerid, "GasCan"))
				{
					ShowErrorDialog(playerid, "You don't have a gas can!");
					return 1;
				}
				new vehicleid = GetPlayerVehicleID(playerid);
				if(Fuel[vehicleid] < 80.0) Fuel[vehicleid] += 20.0;
				else Fuel[vehicleid] = 100.0;
				SetPVarInt(playerid, "GasCan", 0);
				SendClientMessage(playerid, COLOR_WHITE, "You have filled the fuel tank with 20 fuel");
			}
		}
		return 1;
	}
}



Re: Undefined symbol problem!? - u3ber - 30.01.2013

why do you have a bunch of asterisks in your code?


Re: Undefined symbol problem!? - iGetty - 30.01.2013

What are all of the *'s for?

Remove them and I will try and help you.

Edit: Above beat meh'


Re: Undefined symbol problem!? - LuckyPlaya` - 30.01.2013

lol what?


Re: Undefined symbol problem!? - LuckyPlaya` - 30.01.2013

I removed it...i dont know why it appeared here xd its not like that in script

-Now try to help me


Re: Undefined symbol problem!? - mineralo - 30.01.2013

did you declared before cmd as string? and did strtok with ?
its should be near >>>
pawn Код:
public OnPlayerCommandText(playerid,cmdtext)
{
     new cmd[256]; cmd = strtok(cmdtext,0); // do you have that?
//..



Re: Undefined symbol problem!? - LuckyPlaya` - 30.01.2013

Here...What should i ADD and WHERE

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new pos, funcname[32];
	while(cmdtext[++pos] > ' ')
	{
		funcname[pos-1] = tolower(cmdtext[pos]);
	}
	strins(funcname, "cmd_", 0, sizeof(funcname));
	while (cmdtext[pos] == ' ') pos++;
	if(!cmdtext[pos])
	{
		return CallLocalFunction(funcname, "is", playerid, "\1");
	}
	return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
	if(strcmp(cmd,"/car",true)==0) and then its starts that first code



Re: Undefined symbol problem!? - CJay9209 - 30.01.2013

Add

pawn Код:
new cmd[256]; cmd = strtok(cmdtext,0);
Right at the top above the other new items.


Re: Undefined symbol problem!? - LuckyPlaya` - 31.01.2013

I added it. And when i add it then it comes undefined symbol "idx"


-may i just simpli give you the pastebin of whole Fs and you guys try to fix it. But dont delete anything. Just remove errors xd