Possibly fixing issues with putting stock.

This commit is contained in:
BrakingESX247
2020-07-19 18:26:37 +01:00
parent 7b7ab6f797
commit cb085f488d
2 changed files with 18 additions and 12 deletions
+13 -9
View File
@@ -393,15 +393,19 @@ end
function OpenPutStocksMenu()
ESX.TriggerServerCallback('esx_taxijob:getPlayerInventory', function(inventory)
local elements = {}
for i=1, #inventory.items, 1 do
local item = inventory.items[i]
for k,v in ipairs(inventory) do
table.insert(elements, {
label = v.label .. ' x' .. v.count,
type = 'item_standard', -- not used
value = v.name
})
end
if item.count > 0 then
table.insert(elements, {
label = item.label .. ' x' .. item.count,
type = 'item_standard',
value = item.name
})
end
end
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', {
title = _U('inventory'),
align = 'top-left',
@@ -744,4 +748,4 @@ end)
AddEventHandler('esx:onPlayerSpawn', function(spawn)
IsDead = false
end)
end)
+5 -3
View File
@@ -100,7 +100,9 @@ AddEventHandler('esx_taxijob:putStockItems', function(itemName, count)
end
end)
ESX.RegisterServerCallback('esx_taxijob:getPlayerInventory', function(source, cb)
ESX.RegisterServerCallback('esx_policejob:getPlayerInventory', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
cb(xPlayer.getInventory())
end)
local items = xPlayer.inventory
cb({items = items})
end)