Jump to content

[Help] Vehicle spawner


Camper

Recommended Posts

Hello everyone!

That would be the problem that makes it twice as the vehicle

Also, do not print the chat to a vehicle stocked.

The code:

  
function Autocsinalas(thePlayer, command, vehicleModel) 
    local x,y,z = getElementPosition(thePlayer) 
    x = x + 5 
    local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z) 
    local vehname = getVehicleName (vehicleModel) 
    outputChatBox("A lekért jármű : "..vehname.." ("..vehicleModel..")",thePlayer) 
    if (createdVehicle == false) then 
        outputChatBox("A jármű lehívása sikertelen.",thePlayer) 
    end 
end 
addCommandHandler("veh", Autocsinalas) 
  

Thanks in advance!

Sorry for the bad english! I used google translator!

Link to comment

Hello. I also did not understand your post, especially not "Also, do not print the chat to a vehicle stocked."

However, I did see an error that might fix your problems.

Try this:

  
function Autocsinalas(thePlayer, command, vehicleModel) 
    local x,y,z = getElementPosition(thePlayer) 
    x = x + 5 
    local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z) 
  
    local vehname = getVehicleName (createdVehicle)                       
    -- The error was above, because you must put the vehicle as parameter, not the vehicle ID. 
  
    outputChatBox("A lekért jármu : "..vehname.." ("..vehicleModel..")",thePlayer) 
    if (createdVehicle == false) then 
        outputChatBox("A jármu lehívása sikertelen.",thePlayer) 
    end 
end 
addCommandHandler("veh", Autocsinalas) 
  

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