DarkMagic Posted July 11, 2018 Share Posted July 11, 2018 Hi guys! I want to make a script that moves the car rear spoiler when i type the command . But it not working Here is the script : addCommandHandler("spoiler", function() local theVeh = getPedOccupiedVehicle(localPlayer) local getComponent = getVehicleComponents(theVeh) if getComponent == "movspoiler_23.5_1800" then if (theVeh) then for k in pairs (getComponent) do local x, y, z = getVehicleComponentPosition(theVeh, k) setVehicleComponentPosition(theVeh, k, x+1, y+1, z+1) --outputChatBox(k) end end end end ) Link to comment
Addlibs Posted July 11, 2018 Share Posted July 11, 2018 addCommandHandler('spoiler', function() local theVeh = getPedOccupiedVehicle(localPlayer) if (theVeh) then -- if theVeh exists local components = getVehicleComponents(theVeh) if components['movspoiler_23.5_1800'] then -- if this component exists in theVeh local x, y, z = getVehicleComponentPosition(theVeh, 'movspoiler_23.5_1800') setVehicleComponentPosition(theVeh, 'movspoiler_23.5_1800', x+1, y+1, z+1) --outputChatBox(k) end end end ) Link to comment
DarkMagic Posted July 11, 2018 Author Share Posted July 11, 2018 It' s good now! Thanks ! Can i do this : If i reach 200 km/h then the spoiler comes up . 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