mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-01 18:58:54 +00:00
- Pickups now require you to press E once nearby to pick up - Fixed pickup objects sometimes not showing up #420 - Added animation to picking up and throwing items - Added message when inventory cannot accept picking up item
This commit is contained in:
+18
-14
@@ -419,24 +419,28 @@ end)
|
||||
|
||||
RegisterServerEvent('esx:onPickup')
|
||||
AddEventHandler('esx:onPickup', function(id)
|
||||
local playerId = source
|
||||
local pickup = ESX.Pickups[id]
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
local pickup, xPlayer, success = ESX.Pickups[id], ESX.GetPlayerFromId(source)
|
||||
|
||||
if pickup.type == 'item_standard' then
|
||||
if xPlayer.canCarryItem(pickup.name, pickup.count) then
|
||||
xPlayer.addInventoryItem(pickup.name, pickup.count)
|
||||
if pickup then
|
||||
if pickup.type == 'item_standard' then
|
||||
if xPlayer.canCarryItem(pickup.name, pickup.count) then
|
||||
xPlayer.addInventoryItem(pickup.name, pickup.count)
|
||||
success = true
|
||||
else
|
||||
xPlayer.showNotification(_U('threw_cannot_pickup'))
|
||||
end
|
||||
elseif pickup.type == 'item_money' then
|
||||
success = true
|
||||
xPlayer.addMoney(pickup.count)
|
||||
elseif pickup.type == 'item_account' then
|
||||
success = true
|
||||
xPlayer.addAccountMoney(pickup.name, pickup.count)
|
||||
end
|
||||
|
||||
if success then
|
||||
ESX.Pickups[id] = nil
|
||||
TriggerClientEvent('esx:removePickup', -1, id)
|
||||
end
|
||||
elseif pickup.type == 'item_money' then
|
||||
ESX.Pickups[id] = nil
|
||||
TriggerClientEvent('esx:removePickup', -1, id)
|
||||
xPlayer.addMoney(pickup.count)
|
||||
elseif pickup.type == 'item_account' then
|
||||
ESX.Pickups[id] = nil
|
||||
TriggerClientEvent('esx:removePickup', -1, id)
|
||||
xPlayer.addAccountMoney(pickup.name, pickup.count)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user