Merge branch 'main' into remove-connectqueue

This commit is contained in:
BerkieBb
2022-07-29 14:04:10 +03:00
committed by GitHub
8 changed files with 237 additions and 42 deletions
+15
View File
@@ -242,6 +242,7 @@ QBCore.Functions.CreateCallback('QBCore:HasItem', function(source, cb, items, am
cb(retval)
end)
-- Use this for player vehicle spawning
-- Vehicle server-side spawning callback (netId)
-- use the netid on the client with the NetworkGetEntityFromNetworkId native
-- convert it to a vehicle via the NetToVeh native
@@ -253,3 +254,17 @@ QBCore.Functions.CreateCallback('QBCore:Server:SpawnVehicle', function(source, c
if warp then TaskWarpPedIntoVehicle(GetPlayerPed(source), veh, -1) end
cb(NetworkGetNetworkIdFromEntity(veh))
end)
-- Use this for long distance vehicle spawning
-- vehicle server-side spawning callback (netId)
-- 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
cb(NetworkGetNetworkIdFromEntity(veh))
end)