mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Add ESX.SpawnLocalObject
This commit is contained in:
@@ -293,6 +293,28 @@ ESX.Game.SpawnObject = function(model, coords, radius, cb)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ESX.Game.SpawnLocalObject = function(model, coords, radius, cb)
|
||||||
|
|
||||||
|
local model = (type(model) == 'number' and model or GetHashKey(model))
|
||||||
|
|
||||||
|
Citizen.CreateThread(function()
|
||||||
|
|
||||||
|
RequestModel(model)
|
||||||
|
|
||||||
|
while not HasModelLoaded(model) do
|
||||||
|
Citizen.Wait(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
local obj = CreateObject(model, coords.x, coords.y, coords.z, false, true, true)
|
||||||
|
|
||||||
|
if cb ~= nil then
|
||||||
|
cb(obj)
|
||||||
|
end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
ESX.Game.DeleteVehicle = function(vehicle)
|
ESX.Game.DeleteVehicle = function(vehicle)
|
||||||
SetEntityAsMissionEntity(vehicle, false, true)
|
SetEntityAsMissionEntity(vehicle, false, true)
|
||||||
DeleteVehicle(vehicle)
|
DeleteVehicle(vehicle)
|
||||||
|
|||||||
Reference in New Issue
Block a user