forked from Simnation/Main
ed
This commit is contained in:
parent
a07893b242
commit
6509993ea1
2 changed files with 41 additions and 37 deletions
|
@ -1,17 +1,18 @@
|
|||
if GetResourceState('qb-inventory') ~= 'started' then return end
|
||||
if GetResourceState('tgiann-inventory') ~= 'started' then return end
|
||||
local debug = ScriptUtility.Utility.Debug
|
||||
if debug then print('DEBUG ENABLED : Inventory Set To qb-inventory') end
|
||||
if debug then print('DEBUG ENABLED : Inventory Set To tgiann-inventory') end
|
||||
|
||||
Inventory = {
|
||||
GetInventory = function()
|
||||
return Framework.GetFrameworkInventory()
|
||||
end,
|
||||
GetInventory = function()
|
||||
return Framework.GetFrameworkInventory()
|
||||
end,
|
||||
|
||||
HasItem = function(data)
|
||||
return true
|
||||
end,
|
||||
HasItem = function(data)
|
||||
return exports["tgiann-inventory"]:HasItem(data.item, data.amount or 1)
|
||||
end,
|
||||
|
||||
getRootImg = function(item)
|
||||
return 'https://cfx-nui-qb-inventory/html/images/'..item..'.png'
|
||||
end,
|
||||
}
|
||||
getRootImg = function(item)
|
||||
-- tgiann-inventory doesn't have a direct export for this, but we can use the standard path
|
||||
return 'nui://tgiann-inventory/html/images/'..item..'.png'
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,38 +1,41 @@
|
|||
if GetResourceState('qb-inventory') ~= 'started' then return end
|
||||
if ScriptUtility.Utility.Debug then print('DEBUG ENABLED : Inventory Set To qb-inventory') end
|
||||
if GetResourceState('tgiann-inventory') ~= 'started' then return end
|
||||
if ScriptUtility.Utility.Debug then print('DEBUG ENABLED : Inventory Set To tgiann-inventory') end
|
||||
|
||||
Inventory = {
|
||||
CanCarryItem = function(data)
|
||||
return true
|
||||
-- return exports['qb-inventory']:CanAddItem(data.src, data.item, data.amount or 1)
|
||||
end,
|
||||
CanCarryItem = function(data)
|
||||
return exports['tgiann-inventory']:CanCarryItem(data.src, data.item, data.amount or 1)
|
||||
end,
|
||||
|
||||
CanCarryWeight = function(data)
|
||||
return "old_check"
|
||||
end,
|
||||
CanCarryWeight = function(data)
|
||||
-- tgiann has a specific function for this
|
||||
return exports['tgiann-inventory']:CanCarryWeight(data.src, data.weight or 0)
|
||||
end,
|
||||
|
||||
GiveItem = function(data)
|
||||
exports['qb-inventory']:AddItem(data.src, data.item, data.amount or 1, data.slot or nil, data.metadata or nil)
|
||||
TriggerClientEvent('qb-inventory:client:ItemBox', data.src, QBCore.Shared.Items[data.item], 'add', data.amount or 1)
|
||||
exports['tgiann-inventory']:AddItem(data.src, data.item, data.amount or 1, data.slot or nil, data.metadata or nil)
|
||||
end,
|
||||
|
||||
RemoveItem = function(data)
|
||||
local success = exports['qb-inventory']:RemoveItem(data.src, data.item, data.amount or 1, data.slot or nil, data.reason or nil)
|
||||
TriggerClientEvent('qb-inventory:client:ItemBox', data.src, QBCore.Shared.Items[data.item], 'remove', data.amount or 1)
|
||||
return success
|
||||
local success = exports['tgiann-inventory']:RemoveItem(data.src, data.item, data.amount or 1, data.slot or nil, data.metadata or nil)
|
||||
return success
|
||||
end,
|
||||
|
||||
GetPlayerInventory = function(data)
|
||||
return Framework.GetFrameworkInventory(data.src)
|
||||
end,
|
||||
|
||||
GetItemCount = function(data)
|
||||
local item = exports["qb-inventory"]:GetItemsByName(data.src, data.item)
|
||||
return item
|
||||
GetPlayerInventory = function(data)
|
||||
return exports['tgiann-inventory']:GetPlayerItems(data.src)
|
||||
end,
|
||||
|
||||
GetItemBySlot = function(data)
|
||||
return exports["qb-inventory"]:GetItemBySlot(data.src, data.slot)
|
||||
end,
|
||||
GetItemCount = function(data)
|
||||
local items = exports["tgiann-inventory"]:GetItemsByName(data.src, data.item)
|
||||
local count = 0
|
||||
if items then
|
||||
for _, item in pairs(items) do
|
||||
count = count + item.amount
|
||||
end
|
||||
end
|
||||
return count
|
||||
end,
|
||||
|
||||
GetItemBySlot = function(data)
|
||||
return exports["tgiann-inventory"]:GetItemBySlot(data.src, data.slot)
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue