Fix thrown items not synced with mid-joined players

This commit is contained in:
ElPumpo
2019-09-18 13:47:41 +02:00
parent 5159e892fe
commit 8586fdcce2
3 changed files with 25 additions and 3 deletions
+18
View File
@@ -40,6 +40,24 @@ AddEventHandler('esx:playerLoaded', function(xPlayer)
end
end)
RegisterNetEvent('esx:createMissingPickups')
AddEventHandler('esx:createMissingPickups', function(pickups)
for pickupId,v in pairs(pickups) do
ESX.Game.SpawnLocalObject('prop_money_bag_01', v.coords, function(obj)
SetEntityAsMissionEntity(obj, true, false)
PlaceObjectOnGroundProperly(obj)
Pickups[pickupId] = {
id = pickupId,
obj = obj,
label = v.label,
inRange = false,
coords = v.coords
}
end)
end
end)
AddEventHandler('playerSpawned', function()
while not ESX.PlayerLoaded do
Citizen.Wait(1)