Sign in to follow this  

Prevent vehicle explosions

Recommended Posts

Hi. I'd like to stop vehicles exploding and rather just leave them on fire(or low health) to disable them.

Unfortunately, no matter how much I try, I cannot stop them exploding.

Do I need to hook a clientside event for this and cancel it or what?

Share this post

Link to post

here you go :

function cancelExplode() 
addEventHandler("onVehicleExplode", root, cancelExplode) 

Share this post

Link to post

Tried that, can't seem to cancel the explode event.

Went clientside and canceled the onClientVehicleDamage if the health was below a certain point though.

Did this:

function handleVehicleDamage(attacker, weapon, loss, x, y, z, tyre) 
    if getElementHealth(source) < 250 or (getElementHealth(source)-loss) < 250 then 
        setElementHealth(source, 250) 
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage) 

In case anyone else wants to know how.

Share this post

Link to post

Its already solved :lol:

Share this post

Link to post

You can also prevent the explosions of the vehicles, but this will not prevent them to be able blown.

You can cancel:

4: Car  
5: Car Quick 
6: Boat 
7: Heli  

local cancelTheseTypes = { 
function (x,y,z,theType) 
    if cancelTheseTypes[theType] then 

Note: sometimes heli/planes explode using the rocket explosion. (happens when they are already exploded and they get rammed/hit by anything.

Share this post

Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.