Jump to content

Blow up vehicles in water


Tails

Recommended Posts

Hi there,

function explodeVehiclesInWater ( ) 
    local vehicles = getElementsByType ( "vehicle" ) 
    for _, vehicle in ipairs ( vehicles ) do 
        if isElementInWater( vehicle ) then 
        setTimer ( function() 
        blowVehicle( vehicle, true ) 
    end, 10000, 1 ) 
        end 
    end 
end 
addEventHandler ( "onResourceStart", root, explodeVehiclesInWater ) 

If you read the script then you know I want. I need this script to explode vehicles when they go under water.

Ofcourse it's not working so if anyone could take a look and tell me what's wrong with it I would appreciate it a lot!

Thanks in advance

Link to comment
setTimer ( 
    function ( ) 
        for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do 
            if isElementInWater ( vehicle ) then 
                blowVehicle ( vehicle, true ) 
            end 
        end 
    end 
    , 10000, 0 
) 

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