Jump to content

Vehicle id


OrbTanT

Recommended Posts

How can I create a vehicle using the ID of the same, I am using this script, the more they create using the name.

function createVehicleCommand ( thePlayer, commandName, carName ) 
    local carModel = getVehicleModelFromName ( carName ) 
    local x, y, z = getElementPosition ( thePlayer ) 
    if not carModel then 
        outputChatBox ( "That is not a valid car name" ) 
    else 
        createVehicle ( carModel, x + 5, y, z ) 
    outputChatBox ( "A vehicle with model ID of " .. carModel .. " was created!" ) 
    end 
end 
addCommandHandler ( "vehicle", createVehicleCommand ) 

Link to comment

He wants to create a vehicle by ID and not by the name.

Shinigami, try this:

  
function createVehicleCommand ( thePlayer, commandName, vehID ) 
    if not getVehicleNameFromModel(vehID) then 
        outputChatBox ( "That is not a valid vehicle ID" ) 
    else 
        local x, y, z = getElementPosition ( thePlayer ) 
        createVehicle ( tonumber(vehID), x + 5, y, z ) 
        outputChatBox ( "A vehicle with model ID of " .. vehID .. " was created!" ) 
    end 
end 
addCommandHandler ( "vehicle", createVehicleCommand ) 

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