yoya99 Posted November 9, 2014 Share Posted November 9, 2014 How to make it if every vehicle hits an object with over 50 mph that it explodes? (Planes same) Help pls Link to comment
Mr_Moose Posted November 9, 2014 Share Posted November 9, 2014 (edited) Something like this should do it. function blowVehicleOnHit(loss) -- Calculate speed in mph local speedx,speedy,speedz = getElementVelocity(source) local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) local mph = actualspeed*111.847 -- Blow vehicle if mph > 50 then blowVehicle(source) end end addEventHandler("onVehicleDamage", root, blowVehicleOnHit) Edited November 9, 2014 by Guest Link to comment
Pierce Posted November 9, 2014 Share Posted November 9, 2014 brutus * cough * function blowVehicleOnHit(loss) -- Calculate speed in mph local speedx,speedy,speedz = getElementVelocity(source) -- cough cough cough local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) local mph = actualspeed*111.847 -- Blow vehicle if mph > 50 then blowVehicle(source) end end addEventHandler("onVehicleDamage", root, blowVehicleOnHit) * cough * Link to comment
Mr_Moose Posted November 9, 2014 Share Posted November 9, 2014 Ops, that's what happens when you write one line and then then copy the next line above after realizing you done this before the example of getting an element speed in mph are in the wiki btw, I would rather use kmh but it doesn't matter. https://wiki.multitheftauto.com/wiki/GetElementVelocity, thanks for the correction. 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