swag_k_dog Posted October 24, 2017 Posted October 24, 2017 I would like to create a turbo script, but I don't know how to trigger a function when the car changes gear. The vehicles in GTA SA change gear automatically, and I would like if it is possible to trigger a function everytime the event happens. or anything similar? thanks
Moderators IIYAMA Posted October 24, 2017 Moderators Posted October 24, 2017 local lastGear addEventHandler("onClientRender", root, function() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local gear = getVehicleCurrentGear(vehicle) if gear ~= lastGear then triggerEvent("onClientVehicleGearChange", vehicle, gear) lastGear = gear end end end) -- prevent the trigger to activate after entering a vehicle. addEventHandler("onClientPlayerVehicleEnter", localPlayer, function (vehicle) lastGear = getVehicleCurrentGear(vehicle) end) You could try this. (clientside) 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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