OrbTanT Posted August 3, 2014 Share Posted August 3, 2014 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
TAPL Posted August 3, 2014 Share Posted August 3, 2014 I didn't understand what you mean, try to explain better? Link to comment
DNL291 Posted August 3, 2014 Share Posted August 3, 2014 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
Max+ Posted August 3, 2014 Share Posted August 3, 2014 I didn't understand what you mean, try to explain better? i think he want to type command to create vehicle and check if the vehicle is valid or not Link to comment
OrbTanT Posted August 3, 2014 Author Share Posted August 3, 2014 Thank you Max, is exactly what I wanted to create a vehicle for the ID, and thank you to all who helped Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now