Jump to content

vehicle broken start


ODutii

Recommended Posts

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

@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 by JeViCo
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...