joedajoester Posted November 11, 2011 Posted November 11, 2011 Hi all, i am using this script, and need to add a commandhandler and there is no function so i do not know how to add one car1gate1 = createObject(971, 0, 0, 5) car1gate2 = createObject(971, 0, 0, 5) car2gate1 = createObject(971, 0, 0, 5) car2gate2 = createObject(971, 0, 0, 5) Car1 = createVehicle ( 567, -1736, -2895, 55, 0, 0, 236 ) Car2 = createVehicle ( 567, -1744, -2913.3000488281, 55, 0, 354.488, 220 ) attachElements( car1gate1, Car1, 0.4, 6.2, -0.6, 90, 90, 90 ) attachElements( car1gate2, Car1, 0.4, 13.2, -0.6, 90, 90, 90 ) attachElements( car2gate1, Car2, 0.05, 6.2, -0.6, 90, 90, 90 ) attachElements( car2gate2, Car2, 0.05, 13.2, -0.6, 90, 90, 90 ) addVehicleUpgrade ( Car1, 1087 ) addVehicleUpgrade ( Car2, 1087 ) addCommandHandler ( "spatula", attachElements) Thanks ^Dev-PoinT^ for helping with the add upgrade
Castillo Posted November 11, 2011 Posted November 11, 2011 function attach() car1gate1 = createObject(971, 0, 0, 5) car1gate2 = createObject(971, 0, 0, 5) car2gate1 = createObject(971, 0, 0, 5) car2gate2 = createObject(971, 0, 0, 5) Car1 = createVehicle ( 567, -1736, -2895, 55, 0, 0, 236 ) Car2 = createVehicle ( 567, -1744, -2913.3000488281, 55, 0, 354.488, 220 ) attachElements( car1gate1, Car1, 0.4, 6.2, -0.6, 90, 90, 90 ) attachElements( car1gate2, Car1, 0.4, 13.2, -0.6, 90, 90, 90 ) attachElements( car2gate1, Car2, 0.05, 6.2, -0.6, 90, 90, 90 ) attachElements( car2gate2, Car2, 0.05, 13.2, -0.6, 90, 90, 90 ) addVehicleUpgrade ( Car1, 1087 ) addVehicleUpgrade ( Car2, 1087 ) end addCommandHandler ( "spatula", attach)
joedajoester Posted November 11, 2011 Author Posted November 11, 2011 Nothing happens, i get no error in console.
Castillo Posted November 11, 2011 Posted November 11, 2011 Works perfect, the cars get created and these objects attached to them.
joedajoester Posted November 11, 2011 Author Posted November 11, 2011 I need it to attach it to any car when you type /spatula and also the cars that spawn with it.
Castillo Posted November 11, 2011 Posted November 11, 2011 Well, your script is totally different, it creates two cars and attaches these objects to them, plus add the hydraulics. Here I'll leave a script that'll attach it to your vehicle. function attach(thePlayer) if not isPedInVehicle(thePlayer) then return end local vehicle = getPedOccupiedVehicle(thePlayer) local car1gate1 = createObject(971, 0, 0, 5) local car1gate2 = createObject(971, 0, 0, 5) attachElements( car1gate1, vehicle, 0.4, 6.2, -0.6, 90, 90, 90 ) attachElements( car1gate2, vehicle, 0.4, 13.2, -0.6, 90, 90, 90 ) addVehicleUpgrade ( vehicle, 1087 ) end addCommandHandler ( "spatula", attach)
joedajoester Posted November 11, 2011 Author Posted November 11, 2011 I combined it with my script and it does exactly wat i wat One more thing, for the cars that spawn with it, why do they have to have their own gates and with the command they dont?
Castillo Posted November 11, 2011 Posted November 11, 2011 I don't know what are you talking about, maybe you created the objects with the same variables?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now