SA-MP Forums Archive
[HELP] Please, help me with these 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)
+--- Thread: [HELP] Please, help me with these errors! (/showthread.php?tid=350038)



[HELP] A couple errors, help please! :p - Stevee - 11.06.2012

Hi, I'm using the PPC Trucking gamemode (0.3c), with the 0.3e server, I don't know if this is the cause of my problem, but I doubt it.

I'm receiving a few errors from a command I tried to create, it is my first ever command (lol) so it probably won't even work, but I'd still like to know where I'm going wrong and whats causing the errors.

Here are the errors I'm receiving:

Код:
PPC_PlayerCommands.inc(2425) : error 003: declaration of a local variable must appear in a compound block
PPC_PlayerCommands.inc(2427) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2430) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2433) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2436) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2439) : error 021: symbol already defined: "GetVehicleParamsEx"
PPC_PlayerCommands.inc(2442) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2444) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2445) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2448) : error 021: symbol already defined: "SetVehicleParamsEx"
PPC_PlayerCommands.inc(2451) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2454) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2457) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2458) : error 010: invalid function or declaration
PPC_PlayerCommands.inc(2461) : error 010: invalid function or declaration
and here is the function code:

Код:
COMMAND:rengine(playerid, params[]) -- Line 2423
{ -- Line 2424
	// Show /rengine was used -- Line 2425
    SendAdminText(playerid, "/rengine", params); -- Line 2426
     -- Line 2427
    // Declare local variables -- Line 2428
	new OtherPlayer, vehicleid, engine, lights, alarm, doors, bonnet, boot, objective; -- Line 2429
     -- Line 2430
	// Check if the player is logged in -- Line 2431
	if(APlayerData[playerid][LoggedIn] == true) -- Line 2432
	{ -- Line 2433
	    // Check if the player has atleast level 5 -- Line 2434
	    if(APlayerData[playerid][PlayerLevel] >= 5) -- Line 2435
         -- Line 2436
	 	   // Check if the other player is logged in -- Line 2437
	    	if(IsPlayerConnected(OtherPlayer)) -- Line 2438
	    	{ -- Line 2439
	        	// Get the other players vehicle -- Line 2440
	        	vehicleid = GetPlayerVehicleID(OtherPlayer); -- Line 2441
                 -- Line 2442
	        	// Get the current status of the other players vehicle -- Line 2443
	        	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); -- Line 2444
                 -- Line 2445
	        	// Check if the other player is inside a vehicle -- Line 2446
	        	if(vehicleid != 0) -- Line 2447
	        	{ -- Line 2448
	            	if(sscanf(params, "i", engine)) -- Line 2449
					{ -- Line 2450
						SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/engine <EngineStatus 0/1>\""); -- Line 2451
	            	else -- Line 2452
	            	{ -- Line 2453
	                	// Set the engine to the value that was passed by the player and leave all the other parameters alone -- Line 2454
	                	SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); -- Line 2455
					} -- Line Line 2456
				} -- Line 2457
				else -- Line 2458
			    	SendClientMessage(playerid, 0x00FF00FF, "Your target must be inside a vehicle to toggle their engine"); -- Line 2459
			} -- Line 2460
			else -- Line 2461
  				SendClientMessage(playerid, 0xFF0000FF, "Player is not online!"); -- Line 2462
		} -- Line 2463
		else -- Line 2464
			return 0;[COLOR="DarkOrange"] -- Line 2465 -- Line 2466
	// Let the server know that this was a valid command -- Line 2467
	return 1; -- Line 2468
} -- Line 2469
I'm sorry to ask for help, but I've looked around for ages and I can't find a single thing that'll help me.


Re: [HELP] Please, help me with these errors! - Randy More - 11.06.2012

I didn't actually look at the commands and such as, but as you had the script in 0.3c and upgrading it to 0.3e, download the pawno content of 0.3e and open the pawno program from the pawno folder and then open the script after opening the new pawno program. as for "already defined".. if you have some lines that defines this, remove them


Re: [HELP] Please, help me with these errors! - Stevee - 11.06.2012

I'm not 100% what your telling me to do, but I'm already using the pawno from the 0.3e version I downloaded, what I did was this:

Downloaded 0.3e server
Downloaded PPC Trucking

Transferred PPC trucking files/folders over to the 0.3e folder (making sure not to overwrite anything).

----

The main problem I want to solve is the first one, I've looked online for causes of the error but to me the code I use looks fine, but then again this is the first time I've ever scripted PAWN.

Код:
PPC_PlayerCommands.inc(2425) : error 003: declaration of a local variable must appear in a compound block
The script actually worked fine until I started trying to add my own command, lol.

Any help given is appreciated, a lot!


Re: [HELP] Please, help me with these errors! - Stevee - 11.06.2012

Sorry for the double post but

In hope to make everything more clearer for the people who may help, I've added the line numbers to the code


Re: [HELP] Please, help me with these errors! - [NWA]Hannes - 11.06.2012

Quote:
Originally Posted by Stevee
Посмотреть сообщение
Sorry for the double post but

In hope to make everything more clearer for the people who may help, I've added the line numbers to the code
The errors are in the include file, PPC_PlayerCommands.inc.
Not in the script. Dont know how to fix them though :/


Re: [HELP] Please, help me with these errors! - Stevee - 11.06.2012

Yeah, the snippet of code I posted is from PPC_PlayerCommands.inc


Re: [HELP] Please, help me with these errors! - [NWA]Hannes - 11.06.2012

Quote:
Originally Posted by Stevee
Посмотреть сообщение
Yeah, the snippet of code I posted is from PPC_PlayerCommands.inc
Oh ok, nevermind it then


Re: [HELP] Please, help me with these errors! - Stevee - 11.06.2012

Quote:
Originally Posted by [NWA]Hannes
Посмотреть сообщение
Oh ok, nevermind it then
Haha, no problem, thanks for trying anyway.