ODutii Posted July 26, 2019 Share Posted July 26, 2019 When the player enters the vehicle and the damage is at 300, the vehicle will not start, what is wrong? function broken(player) if getElementHealth(player) >= 301 then setVehicleEngineState(player, true) elseif getRootElement(player) <=300 then setVehicleEngineState(player, false) end end addEventHandler("onVehicleEnter", root,broken) Link to comment
JeViCo Posted July 26, 2019 Share Posted July 26, 2019 (edited) @ODutii, you're checking player's health right here getElementHealth(player) >= 301 you might also need to check seats: function broken(player, seat) if seat == 0 then -- driver if getElementHealth(source) > 300 then setVehicleEngineState(source, true) else setVehicleEngineState(source, false) end end end addEventHandler("onVehicleEnter", root,broken) Source (wiki) The source of this event is the vehicle that was entered. Edited July 26, 2019 by JeViCo Link to comment
ODutii Posted July 26, 2019 Author Share Posted July 26, 2019 Did not work what I do? 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