SA-MP Forums Archive
Weired...Trees attached in place of neons ?? - 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: Weired...Trees attached in place of neons ?? (/showthread.php?tid=577991)



Weired...Trees attached in place of neons ?? - Adarsh007 - 15.06.2015

Hello guys..
I added Neon System in my GM from Somewhere on Internet.
But Trees/plants get attached in place of neons..its weired !! What to do ??


Here is the main code of the neon system -

Код:
if(dialogid == NEONMENU)
{
	if(response)
	{
		if(listitem == 0)
		{
			//blue
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "neon", CreateDynamicObject(18648,0,0,0,0,0,0));
			SetPVarInt(playerid, "neon1", CreateDynamicObject(18648,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "neon"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "neon1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
		}
		if(listitem == 1)
		{
			//red
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "neon2", CreateDynamicObject(18647,0,0,0,0,0,0));
			SetPVarInt(playerid, "neon3", CreateDynamicObject(18647,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "neon2"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "neon3"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "neon installed");
		}
		if(listitem == 2)

		{
			//green
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "neon4", CreateDynamicObject(18649,0,0,0,0,0,0));
			SetPVarInt(playerid, "neon5", CreateDynamicObject(18649,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "neon4"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "neon5"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "neon installed");
		}
		if(listitem == 3)

		{
			//white
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "neon6", CreateDynamicObject(18652,0,0,0,0,0,0));
			SetPVarInt(playerid, "neon7", CreateDynamicObject(18652,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "neon6"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "neon7"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "neon installed");
		}
		if(listitem == 4)
		{
			//pink
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "neon8", CreateDynamicObject(18651,0,0,0,0,0,0));
			SetPVarInt(playerid, "neon9", CreateDynamicObject(18651,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "neon8"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "neon9"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "neon installed");
		}
		if(listitem == 5)
  		{
			//yellow
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "neon10", CreateDynamicObject(18650,0,0,0,0,0,0));
			SetPVarInt(playerid, "neon11", CreateDynamicObject(18650,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "neon10"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "neon11"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "neon installed");
		}
		if(listitem == 6)
		{
			//police
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "neon12", CreateDynamicObject(18646,0,0,0,0,0,0));
			SetPVarInt(playerid, "neon13", CreateDynamicObject(18646,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "neon12"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "neon13"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "neon installed");
		}
		if(listitem == 7)
		{
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "interior", CreateDynamicObject(18646,0,0,0,0,0,0));
			SetPVarInt(playerid, "interior1", CreateDynamicObject(18646,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "interior"), GetPlayerVehicleID(playerid), 0, -0.0, 0, 2.0, 2.0, 3.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "interior1"), GetPlayerVehicleID(playerid), 0, -0.0, 0, 2.0, 2.0, 3.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "Interior lights installed");
		}
		if(listitem == 8)
		{
			//back
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "back", CreateDynamicObject(18646,0,0,0,0,0,0));
			SetPVarInt(playerid, "back1", CreateDynamicObject(18646,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "back"), GetPlayerVehicleID(playerid), -0.0, -1.5, -1, 2.0, 2.0, 3.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "back1"), GetPlayerVehicleID(playerid), -0.0, -1.5, -1, 2.0, 2.0, 3.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "Back neon installed");
		}
		if(listitem == 9)
		{
			//front
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "front", CreateDynamicObject(18646,0,0,0,0,0,0));
			SetPVarInt(playerid, "front1", CreateDynamicObject(18646,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "front"), GetPlayerVehicleID(playerid), -0.0, 1.5, -0.6, 2.0, 2.0, 3.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "front1"), GetPlayerVehicleID(playerid), -0.0, 1.5, -0.6, 2.0, 2.0, 3.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "Front neon installed");
		}
		if(listitem == 10)
		{
			//undercover
			SetPVarInt(playerid, "Status", 1);
			SetPVarInt(playerid, "undercover", CreateDynamicObject(18646,0,0,0,0,0,0));
			SetPVarInt(playerid, "undercover1", CreateDynamicObject(18646,0,0,0,0,0,0));
			AttachObjectToVehicle(GetPVarInt(playerid, "undercover"), GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
			AttachObjectToVehicle(GetPVarInt(playerid, "undercover1"), GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
			SendClientMessage(playerid, 0xFFFFFFAA, "Undercover lights installed");
		}
		if(listitem == 11)
		{
			//remove neon
			DestroyObject(GetPVarInt(playerid, "neon"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon1"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon2"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon3"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon4"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon5"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon6"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon7"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon8"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon9"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon10"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon11"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon12"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "neon13"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "interior"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "interior1"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "back"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "back1"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "front"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "front1"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "undercover"));
			DeletePVar(playerid, "Status");
			DestroyObject(GetPVarInt(playerid, "undercover1"));

			DeletePVar(playerid, "Status");
			}
		}
	}



Re: Weired...Trees attached in place of neons ?? - kristo - 15.06.2015

Use AttachDynamicObjectToVehicle instead of AttachObjectToVehicle.


Re: Weired...Trees attached in place of neons ?? - Adarsh007 - 16.06.2015

Okay..

I added that but...Now Even nothing get attached to vehicle It says Neon added but nothing appears...


Code.
Код:
if(dialogid == DIALOG_NEON)
	{
		if(response)
		{
		    if(listitem == 0)
		    {
		        SetPVarInt(playerid, "neon", 1);
            	SetPVarInt(playerid, "blue", CreateDynamicObject(18648,0,0,0,0,0,0));
            	SetPVarInt(playerid, "blue1", CreateDynamicObject(18648,0,0,0,0,0,0));
            	AttachDynamicObjectToVehicle(GetPVarInt(playerid, "blue"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
            	AttachDynamicObjectToVehicle(GetPVarInt(playerid, "blue1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
            	GameTextForPlayer(playerid, "~b~ Blue ~w~Neon has been added to your vehicle",3500,5);
            	return 1;
			}
			if(listitem == 1)
			{
   				SetPVarInt(playerid, "neon", 1);
       			SetPVarInt(playerid, "green", CreateDynamicObject(18649,0,0,0,0,0,0));
       			SetPVarInt(playerid, "green1", CreateDynamicObject(18649,0,0,0,0,0,0));
       			AttachDynamicObjectToVehicle(GetPVarInt(playerid, "green"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
          		AttachDynamicObjectToVehicle(GetPVarInt(playerid, "green1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
          		GameTextForPlayer(playerid, "~g~Green ~w~Neon has been added to your vehicle",3500,5);
          		return 1;
			}
			if(listitem == 2)
			{
			    SetPVarInt(playerid, "neon", 1);
       			SetPVarInt(playerid, "yellow", CreateDynamicObject(18650,0,0,0,0,0,0));
          		SetPVarInt(playerid, "yellow1", CreateDynamicObject(18650,0,0,0,0,0,0));
            	AttachDynamicObjectToVehicle(GetPVarInt(playerid, "yellow"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
             	AttachDynamicObjectToVehicle(GetPVarInt(playerid, "yellow1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
				GameTextForPlayer(playerid, "~y~Yellow~w~ Neon has been added to your vehicle",3500,5);
				return 1;
			}
			if(listitem == 3)
			{
   				SetPVarInt(playerid, "neon", 1);
   				SetPVarInt(playerid, "white", CreateDynamicObject(18652,0,0,0,0,0,0));
   				SetPVarInt(playerid, "white1", CreateDynamicObject(18652,0,0,0,0,0,0));
       			AttachDynamicObjectToVehicle(GetPVarInt(playerid, "white"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
          		AttachDynamicObjectToVehicle(GetPVarInt(playerid, "white1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, "~w~White~w~ Neon has been added to your vehicle",3500,5);
                return 1;
			}
			if(listitem == 4)
			{
   				SetPVarInt(playerid, "neon", 1);
     			SetPVarInt(playerid, "pink", CreateDynamicObject(18651,0,0,0,0,0,0));
        		SetPVarInt(playerid, "pink1", CreateDynamicObject(18651,0,0,0,0,0,0));
          		AttachDynamicObjectToVehicle(GetPVarInt(playerid, "pink"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
            	AttachDynamicObjectToVehicle(GetPVarInt(playerid, "pink1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
				GameTextForPlayer(playerid, "~p~Pink~w~ Neon has been added to your vehicle",3500,5);
				return 1;
			}
			if(listitem == 5)
			{
	   			DestroyDynamicObject(GetPVarInt(playerid, "blue"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "blue1"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "green"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "green1"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "yellow"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "yellow1"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "white"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "white1"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "pink"));
	            DeletePVar(playerid, "neon");
	            DestroyDynamicObject(GetPVarInt(playerid, "pink1"));
	            DeletePVar(playerid, "neon");
	            GameTextForPlayer(playerid, "~g~Neon was deleted from your vehicle",3500,5);
	            return 1;
            }
		}
 	}



Re: Weired...Trees attached in place of neons ?? - SpaceX - 16.06.2015

Use CreateObject instead of CreateDynamicObject in your code you posted.

Read: AttachObjectToVehicle and refer GameObjectIDList

Quoting:
Quote:
Originally Posted by SA:MP Wiki
objectid: The ID of the object to attach to the vehicle. Note that this is an object ID, not a model ID. The object must be CreateObject created first.
Also,
I would recommend using switch-case instead of if-else.


Re: Weired...Trees attached in place of neons ?? - Adarsh007 - 16.06.2015

Can you do that for me ??
My Problem is Trees get attached Inplace of Neon.


Re: Weired...Trees attached in place of neons ?? - Adarsh007 - 16.06.2015

bump...any help ?


Re: Weired...Trees attached in place of neons ?? - Adarsh007 - 18.06.2015

BUMP !! I STILL NEEED THIS SHIT


Re: Weired...Trees attached in place of neons ?? - Pottus - 18.06.2015

Quote:
Originally Posted by SpaceX
Посмотреть сообщение
Use CreateObject instead of CreateDynamicObject in your code you posted.

Read: AttachObjectToVehicle and refer GameObjectIDList

Quoting:


Also,
I would recommend using switch-case instead of if-else.
CreateDynamicObject() is fine to use actually it is best so it doesn't eat up object slots when you don't have to!