FuriouZ Posted April 17, 2014 Share 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 ? Link to comment
cheez3d Posted April 17, 2014 Share Posted April 17, 2014 The event "onVehicleDamage" has the loss parameter. https://wiki.multitheftauto.com/wiki/OnVehicleDamage Link to comment
FuriouZ Posted April 17, 2014 Author Share 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 Link to comment
FuriouZ Posted April 17, 2014 Author Share Posted April 17, 2014 The event "onVehicleDamage" has the loss parameter.https://wiki.multitheftauto.com/wiki/OnVehicleDamage Thanks, it worked perfectly ! Link to comment
FuriouZ Posted April 17, 2014 Author Share Posted April 17, 2014 I have another question, how i can check if vehicle is falling ? isVehicleOnGround ? Link to comment
.:HyPeX:. Posted April 17, 2014 Share 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 Link to comment
FuriouZ Posted April 17, 2014 Author Share 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 ) Link to comment
cheez3d Posted April 17, 2014 Share 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) 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