mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 00:01:22 +00:00
chore(server/events): remove redundant vehicle spawning
This commit is contained in:
+2
-18
@@ -269,18 +269,7 @@ end)
|
||||
-- use the netid on the client with the NetworkGetEntityFromNetworkId native
|
||||
-- convert it to a vehicle via the NetToVeh native
|
||||
QBCore.Functions.CreateCallback('QBCore:Server:SpawnVehicle', function(source, cb, model, coords, warp)
|
||||
local ped = GetPlayerPed(source)
|
||||
model = type(model) == 'string' and joaat(model) or model
|
||||
if not coords then coords = GetEntityCoords(ped) end
|
||||
local veh = CreateVehicle(model, coords.x, coords.y, coords.z, coords.w, true, true)
|
||||
while not DoesEntityExist(veh) do Wait(0) end
|
||||
if warp then
|
||||
while GetVehiclePedIsIn(ped) ~= veh do
|
||||
Wait(0)
|
||||
TaskWarpPedIntoVehicle(ped, veh, -1)
|
||||
end
|
||||
end
|
||||
while NetworkGetEntityOwner(veh) ~= source do Wait(0) end
|
||||
local veh = QBCore.Functions.SpawnVehicle(source, model, coords, warp)
|
||||
cb(NetworkGetNetworkIdFromEntity(veh))
|
||||
end)
|
||||
|
||||
@@ -289,12 +278,7 @@ end)
|
||||
-- use the netid on the client with the NetworkGetEntityFromNetworkId native
|
||||
-- convert it to a vehicle via the NetToVeh native
|
||||
QBCore.Functions.CreateCallback('QBCore:Server:CreateVehicle', function(source, cb, model, coords, warp)
|
||||
model = type(model) == 'string' and GetHashKey(model) or model
|
||||
if not coords then coords = GetEntityCoords(GetPlayerPed(source)) end
|
||||
local CreateAutomobile = GetHashKey("CREATE_AUTOMOBILE")
|
||||
local veh = Citizen.InvokeNative(CreateAutomobile, model, coords, coords.w, true, true)
|
||||
while not DoesEntityExist(veh) do Wait(0) end
|
||||
if warp then TaskWarpPedIntoVehicle(GetPlayerPed(source), veh, -1) end
|
||||
local veh = QBCore.Functions.CreateAutomobile(source, model, coords, warp)
|
||||
cb(NetworkGetNetworkIdFromEntity(veh))
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user