Jump to content

Function?


joedajoester

Recommended Posts

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 :D

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

Link to comment
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) 

Link to comment

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) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...