Jump to content

Freeze a vehicle?


Recommended Posts

Hello, I have some questions about freezing a vehicle. I make a server and with a .map file I create vehicles. What I want is when the server starts all the vehicles should be frozen immediately. But how to do this? I know I can get the vehicle by the following line:

local vehicle = getElementByID("vehicle") 

And I know I can freeze the vehicle with the following line:

setVehicleFrozen(vehicle,true) 

But how to run this immediately when the server starts?

Thanks a lot!

Bierbuikje

Link to comment
addEventHandler("onClientResourceStart", getRootElement( ),  
    function ( )  
        getAllVehicles = function ( )  
            local vehicles = getElementByID( "vehicle" ); 
            return vehicles; 
                        end; 
        setVehiclesFrozen = function ( )  
            for _,vehicle in pairs ( getAllVehicles ( ) ) do  
                setVehicleFrozen( vehicle, true ); 
            end; 
                            end; 
    end ) 

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