Jump to content

Spawning cars with a table..


Xeno

Recommended Posts

Like, if I were to enter a certain car, and if that vehicle was the one spawned like this:

myvehicle = createVehicle 

It would output a chat box message.

If I use onClientVehicleEnter it will output the text when you enter any vehicle, I need it so it only outputs the text when you enter myVehicle

Link to comment
Sorry for the double post, again ( I dont want to make a new topic for such a small problem..)

But I cant seem to enter the vehicle if its been made on the table??? Please help D:

this because you're using createVehicle from client side [-X , if you using them server side you will be able to enter the vehicle.

Link to comment
Sorry for the double post, again ( I dont want to make a new topic for such a small problem..)

But I cant seem to enter the vehicle if its been made on the table??? Please help D:

Like that ?

local vehicles = { 
    {model=411, x=0, y=0, z=3, rot=0} 
} 
  
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
function() 
    for index, vehicle in ipairs(vehicles) do 
        local car = createVehicle(vehicle.model, vehicle.x, vehicle.y, vehicle.z, 0, 0, vehicle.rot) 
        addEventHandler("onVehicleEnter", getRootElement(), 
        function() 
            if(source == car)then 
                outputChatBox("You have entered the vehicle") 
            end 
        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...