Spawning non-car vehicules

For my server i want to allow clients to spawn helicopters, planes and boats with a command (example /personalboat)
But i can manage to do that. With the basic event ‘createCarAtPlayerPos’ that spawn an entity near you. Here is the code of the eventhandler

RegisterNetEvent("createCarAtPlayerPos")
AddEventHandler('createCarAtPlayerPos', function(message, personal)
    Citizen.CreateThread(function()
        Citizen.Wait(50)
        local carid = GetHashKey(message)
        local playerPed = GetPlayerPed(-1)
        if playerPed and playerPed ~= -1 then
            RequestModel(carid)
            while not HasModelLoaded(carid) do
                Citizen.Wait(0)
            end
            local playerCoords = GetEntityCoords(playerPed)
            playerCoords = playerCoords + vector3(0, 2, 0)
			
       if(lastSpawnedVehicle ~= nil)then				
          SetEntityCoords(lastSpawnedVehicle, -1932.0, -1299.0, -12.0)
       end
			
       lastSpawnedVehicle = CreateVehicle(carid, playerCoords, 0.0, true, false)
       TaskWarpPedIntoVehicle(playerPed, lastSpawnedVehicle, -1)
       if(personal)then
              playerVehicle = lastSpawnedVehicle
       end
    end
  end)
end)

And the call :


TriggerClientEvent("createCarAtPlayerPos", source, 'NAMEOFCAR', true)

Does someone know how i can modifiy this or how can i create an other?
PS: i also tried to add a boat in a VehiculeShop but didn’t work.
PS2: i don’t want to use lambda menu.

Thanks

Heading

I’m not sure exactly what you are looking for, but this script allows you to spawn any vehicle including helis etc. in chat with /spawn.

I believe Scorpio trainer now lets you do this as well.

hello everyone here it is two days that I try to put vehicle on my server

link: http: //www.gtamodding.fr/vehicules/5821-scania-113h-guincho-4x6-funcional.html

I have succeeded for the texture of the vehicle but not the hook I wonder if it was possible to activate it because I do not find how to do that

thank you to all those who will take the time to answer

Look at the date… don’t bump ancient topics.