/coplights command
#1

Here's the cmd, and and below it's the errors. Having huge trouble on it, and wondering what i'm doing wrong. If someone can tell me how to fix them, that'd be great.

Код:
	if(strcmp(cmd, "/coplights", true) == 0)
	new vehicle = GetPlayerVehicleID(playerid);
	if(IsPlayerInAnyVehicle(playerid))
	{
	    if(Coplights[playerid] == 0)
	    {
	        new objectid = CreateObject(19419, 0, 0, 0, 0, 0, 0);
	        AttachObjectToVehicle(objectid, GetPlayerVehicleID(playerid), 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000); //Object Model: 19419
			format(string, sizeof(string), "%s has attached coplights to their car.", sendername);
			ProxDetector(20.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			Coplights[playerid] = 1;
		}
		else
		{
			DestroyObject(objectid, GetPlayerVehicleID(playerid));
		    format(string, sizeof(string), "%s has removed the coplights from their car.", sendername);
			ProxDetector(20.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			Coplights[playerid] = 0;
		}
		return 1;
	}
Errors:

C:\Users\Jay\Desktop\New Nation Roleplay\gamemodes\NNRP.pwn(27062) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Jay\Desktop\New Nation Roleplay\gamemodes\NNRP.pwn(27062) : error 017: undefined symbol "vehicle"
C:\Users\Jay\Desktop\New Nation Roleplay\gamemodes\NNRP.pwn(27075) : error 017: undefined symbol "objectid"
Reply
#2

after if(strcmp(cmd, "/coplights", true) == 0)
Put a {

and at the end of that piece of code a }
Reply
#3

Quote:
Originally Posted by ikkentim
Посмотреть сообщение
after if(strcmp(cmd, "/coplights", true) == 0)
Put a {

and at the end of that piece of code a }
Thanks, that fixed a couple of the errors, now my major problem is with

C:\Users\Jay\Desktop\New Nation Roleplay\gamemodes\NNRP.pwn(27076) : error 017: undefined symbol "objectid"

I don't get how it's a undefined symbol, when it's used in the script tons of times, and doesn't give a problem there. Why on /coplights?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)