Jump to content

Vehicle damage taken


FuriouZ

Recommended Posts

I have another question, how i can check if vehicle is falling ?

isVehicleOnGround ?

you should check the vehicle velocity within some time (id say client render)

  
local vx,vy,vz = getElementVelocity(vehicle) 
if vz < 0  then 
if not isVehicleOnGround(vehicle) 
--falling in Z position (CHECK THAT GOING DOWN A HILL WITH A SMALL JUMP WILL ALSO DO THIS POSITIVE) 
end 
end 
  

Link to comment

Bad argument @ isVehicleOnGround

addEventHandler("onVehicleDamage", root,  
    function( loss, vehicle, seat, jacked ) 
        local g_Vehicle = getVehicleOccupant(source)     
        local vx,vy,vz = getElementVelocity(g_Vehicle)       
            if vz < 0  then 
                if not isVehicleOnGround(vehicle) then 
                    if ( tonumber( loss ) >= 350 )  then 
                        blowVehicle ( source ) 
                    end 
                end 
            end 
    end          
)  

Link to comment
  
addEventHandler("onVehicleDamage",root,function(loss) 
    --local player = getVehicleOccupant(source,0) //no need to use this 
    local _,_,vz = getElementVelocity(source) 
    if vz>0 and not isVehicleOnGround(source) and loss >=350 then 
        blowVehicle(source) 
    end 
end) 
  

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...