Jump to content

No explode car


MatXpl

Recommended Posts

Hi! I make this code:

function nobum() 
local vehicle = getElementsByType ( "vehicle" ) 
if ( isVehicleFuelTankExplodable ( vehicle ) ) then 
setVehicleDamageProof ( vehicle, true ) 
end 
end 
addEventHandler("onVehicleDamage", getRootElement(), nobum) 
  
function damage() 
local vehicle = getElementsByType ( "vehicle" ) 
    if isVehicleDamageProof ( vehicle ) then 
    timerv = setTimer (function() setVehicleEngineState ( vehicle, false ) end, 2100, 1) 
    resetTimer ( timerv ) 
    end 
end 
addEventHandler("onVehicleDamage", getRootElement(), damage) 

and i wont to car no explode but this script dosn't work :(

debugscript:

Bad argument @ 'isVehicleFuelTankExplodable

Bad argument @ 'isVehicleDamageProof

pls Help what is wrong ?

Link to comment

try this:

function nobum() 
    if ( isVehicleFuelTankExplodable ( source ) ) then 
        setVehicleDamageProof ( source, true ) 
    end 
end 
addEventHandler("onVehicleDamage", getRootElement(), nobum) 
  
function damage() 
    if isVehicleDamageProof ( source ) then 
        setTimer (setVehicleEngineState, 2100, 1, source, false) 
    end 
end 
addEventHandler("onVehicleDamage", getRootElement(), damage) 

https://wiki.multitheftauto.com/wiki/OnVehicleDamage

Link to comment

you could always edit the code that spawns the cars in the first place,

am i right in thinking you just want the cars to not explode when the gas tank is hit?

if so, you could use:

bool setVehicleFuelTankExplodable ( vehicle theVehicle, bool explodable )

wherever the cars are created, just add this as the next line:

setVehicleFuelTankExplodable (theVehicle, false) 

if im wrong and you just dont want cars to explode ever.. you could use cancelEvent() in onVehicleExplode

Link to comment
try this:
function nobum() 
    if ( isVehicleFuelTankExplodable ( source ) ) then 
        setVehicleDamageProof ( source, true ) 
    end 
end 
addEventHandler("onVehicleDamage", getRootElement(), nobum) 
  
function damage() 
    if isVehicleDamageProof ( source ) then 
        setTimer (setVehicleEngineState, 2100, 1, source, false) 
    end 
end 
addEventHandler("onVehicleDamage", getRootElement(), damage) 

https://wiki.multitheftauto.com/wiki/OnVehicleDamage

Thanks, but car explode...

@Edit

I edit this code :arrowup: and its works :D ( I used https://wiki.multitheftauto.com/wiki/GetElementHealth )

Thanks 4 all!

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