diff --git a/resources/[essential]/es_extended/client/main.lua b/resources/[essential]/es_extended/client/main.lua index 1d9ffa1e..0fff86b3 100644 --- a/resources/[essential]/es_extended/client/main.lua +++ b/resources/[essential]/es_extended/client/main.lua @@ -270,12 +270,12 @@ AddEventHandler('esx:spawnObject', function(model) end) RegisterNetEvent('esx:pickup') -AddEventHandler('esx:pickup', function(id, label) +AddEventHandler('esx:pickup', function(id, label, coords) - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - local forward = GetEntityForwardVector(playerPed) - local x, y, z = table.unpack(coords + forward * -2.0) + local ped = GetPlayerPed(GetPlayerFromServerId(player)) + local coords = GetEntityCoords(ped) + local forward = GetEntityForwardVector(ped) + local x, y, z = table.unpack(coords + forward * -2.0) ESX.Game.SpawnLocalObject('prop_money_bag_01', { x = x, diff --git a/resources/[essential]/es_extended/server/functions.lua b/resources/[essential]/es_extended/server/functions.lua index 45582314..ae1bc2e7 100644 --- a/resources/[essential]/es_extended/server/functions.lua +++ b/resources/[essential]/es_extended/server/functions.lua @@ -224,7 +224,7 @@ ESX.GetWeaponLabel = function(name) end -ESX.CreatePickup = function(type, name, count, label) +ESX.CreatePickup = function(type, name, count, label, player) local pickupId = (ESX.PickupId == 65635 and 0 or ESX.PickupId + 1) @@ -234,7 +234,7 @@ ESX.CreatePickup = function(type, name, count, label) count = count } - TriggerClientEvent('esx:pickup', -1, pickupId, label) + TriggerClientEvent('esx:pickup', -1, pickupId, label, player) ESX.PickupId = pickupId diff --git a/resources/[essential]/es_extended/server/main.lua b/resources/[essential]/es_extended/server/main.lua index 1a9134c3..e634c744 100644 --- a/resources/[essential]/es_extended/server/main.lua +++ b/resources/[essential]/es_extended/server/main.lua @@ -404,7 +404,7 @@ AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount) if total > 0 then xPlayer.removeInventoryItem(itemName, total) - ESX.CreatePickup('item_standard', itemName, total, foundItem.label) + ESX.CreatePickup('item_standard', itemName, total, foundItem.label, _source) TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' ' .. foundItem.label .. ' x' .. total) end @@ -439,7 +439,7 @@ AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount) if total > 0 then xPlayer.removeMoney(total) - ESX.CreatePickup('item_money', 'money', total, 'Cash') + ESX.CreatePickup('item_money', 'money', total, 'Cash', _source) TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' [Cash] $' .. total) end @@ -474,7 +474,7 @@ AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount) if total > 0 then xPlayer.removeAccountMoney(itemName, total) - ESX.CreatePickup('item_account', itemName, total, 'Cash') + ESX.CreatePickup('item_account', itemName, total, 'Cash', _source) TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' [Cash] $' .. total) end