FuriouZ Posted April 17, 2014 Posted April 17, 2014 Hello! My question is how i can check how many damage the vehicle is taken ? For example, if vehicle is driving into the wall, how i can check how many damage vehicle got ?
cheez3d Posted April 17, 2014 Posted April 17, 2014 The event "onVehicleDamage" has the loss parameter. https://wiki.multitheftauto.com/wiki/OnVehicleDamage
FuriouZ Posted April 17, 2014 Author Posted April 17, 2014 onClientVehicleDamage Yes, i know, but i wan't to do that if vehicle got more than 30% damage on wall hitting, then the car blows up
FuriouZ Posted April 17, 2014 Author Posted April 17, 2014 The event "onVehicleDamage" has the loss parameter.https://wiki.multitheftauto.com/wiki/OnVehicleDamage Thanks, it worked perfectly !
FuriouZ Posted April 17, 2014 Author Posted April 17, 2014 I have another question, how i can check if vehicle is falling ? isVehicleOnGround ?
.:HyPeX:. Posted April 17, 2014 Posted April 17, 2014 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
FuriouZ Posted April 17, 2014 Author Posted April 17, 2014 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 )
cheez3d Posted April 17, 2014 Posted April 17, 2014 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)
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