function getDisplayInventory(identifier, type, cb, source)
local player = ESX.GetPlayerFromId(source)
local bagc = player.getInventoryItem('bag').count
if bagc >= 1 then
bagc = 10
else
bagc = 0
end
InvType[type].getInventory(identifier, function(inventory)
local itemsObject = {}
for k, v in pairs(inventory) do
if k ~= 'cash' and k ~= 'black_money' then
local esxItem = player.getInventoryItem(v.name)
local item = createDisplayItem(v, esxItem, tonumber(k))
item.usable = false
item.giveable = false
item.canRemove = false
table.insert(itemsObject, item)
end
end
local inv
if type == 'player' then
local targetPlayer = ESX.GetPlayerFromIdentifier(identifier)
inv = {
invId = identifier,
invTier = InvType[type],
inventory = itemsObject,
bagcount = bagc,
cash = targetPlayer.getMoney(),
black_money = targetPlayer.getAccount('black_money').money
}
else
inv = {
invId = identifier,
invTier = InvType[type],
inventory = itemsObject,
bagcount = bagc,
cash = inventory['cash'] or 0,
black_money = inventory['black_money'] or 0
}
end
cb(inv)
end)
end