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