mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 02:08:55 +00:00
Fix thrown items not synced with mid-joined players
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -162,16 +162,19 @@ ESX.GetItemLabel = function(item)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.CreatePickup = function(type, name, count, label, player)
|
||||
ESX.CreatePickup = function(type, name, count, label, playerId)
|
||||
local pickupId = (ESX.PickupId == 65635 and 0 or ESX.PickupId + 1)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
ESX.Pickups[pickupId] = {
|
||||
type = type,
|
||||
name = name,
|
||||
count = count
|
||||
count = count,
|
||||
label = label,
|
||||
coords = xPlayer.getCoords()
|
||||
}
|
||||
|
||||
TriggerClientEvent('esx:pickup', -1, pickupId, label, player)
|
||||
TriggerClientEvent('esx:pickup', -1, pickupId, label, playerId)
|
||||
ESX.PickupId = pickupId
|
||||
end
|
||||
|
||||
|
||||
@@ -234,6 +234,7 @@ AddEventHandler('es:playerLoaded', function(source, _player)
|
||||
})
|
||||
|
||||
xPlayer.displayMoney(xPlayer.getMoney())
|
||||
TriggerClientEvent('esx:createMissingPickups', _source, ESX.Pickups)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user