Peti930 Posted April 13, 2018 Share Posted April 13, 2018 Hi i want to make a script to if i type /trunk the trunk is goingto open and i type it again the trunk is closeing OR not /trunk, bind it to End Link to comment
Dimos7 Posted April 13, 2018 Share Posted April 13, 2018 (edited) that is the functions you need getPedOccupiedVehicle setVehicleDoorState addCommandHandler Edited April 13, 2018 by Dimos7 Link to comment
Peti930 Posted April 13, 2018 Author Share Posted April 13, 2018 Can u give me instructions? Link to comment
Dimos7 Posted April 13, 2018 Share Posted April 13, 2018 (edited) local trunkDoor = -- put true or false if you want first time open put false function toggleTrunk(player) if isPedInVehicle(player) then - check player is in a car. local car = getPedOccupiedVehicle(player) -- takes the car the player is inside. if turnkDoor then -- put here trunk door and check if it false for open it or close it setVehicleDoorOpenRatio(car) else setVehicleDoorOpenRatio(car) end end end addCommandHandler("trunk", toggleTrunk) Edited April 13, 2018 by Dimos7 Link to comment
LLCoolJ Posted April 13, 2018 Share Posted April 13, 2018 local ms = 1000 addCommandHandler("trunk", function(player) local vehicle = getPedOccupiedVehicle(player) if isElement(vehicle) then if getVehicleDoorOpenRatio(vehicle,1) > 0 then setVehicleDoorOpenRatio(vehicle,1,0,ms) else setVehicleDoorOpenRatio(vehicle,1,1,ms) end end end) Server side Link to comment
Peti930 Posted April 13, 2018 Author Share Posted April 13, 2018 Can u make it i can use it in vehicle Bullet? (Veh id: 541) Link to comment
LLCoolJ Posted April 13, 2018 Share Posted April 13, 2018 local ms = 1000 addCommandHandler("trunk", function(player) local vehicle = getPedOccupiedVehicle(player) if isElement(vehicle) and getElementModel(vehicle) == 541 then if getVehicleDoorOpenRatio(vehicle,1) > 0 then setVehicleDoorOpenRatio(vehicle,1,0,ms) else setVehicleDoorOpenRatio(vehicle,1,1,ms) end end end) Use getElementModel Link to comment
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