forked from Simnation/Main
ed
This commit is contained in:
parent
a07893b242
commit
6509993ea1
2 changed files with 41 additions and 37 deletions
|
@ -1,6 +1,6 @@
|
||||||
if GetResourceState('qb-inventory') ~= 'started' then return end
|
if GetResourceState('tgiann-inventory') ~= 'started' then return end
|
||||||
local debug = ScriptUtility.Utility.Debug
|
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 = {
|
Inventory = {
|
||||||
GetInventory = function()
|
GetInventory = function()
|
||||||
|
@ -8,10 +8,11 @@ Inventory = {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
HasItem = function(data)
|
HasItem = function(data)
|
||||||
return true
|
return exports["tgiann-inventory"]:HasItem(data.item, data.amount or 1)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
getRootImg = function(item)
|
getRootImg = function(item)
|
||||||
return 'https://cfx-nui-qb-inventory/html/images/'..item..'.png'
|
-- 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,
|
end,
|
||||||
}
|
}
|
|
@ -1,38 +1,41 @@
|
||||||
if GetResourceState('qb-inventory') ~= 'started' then return end
|
if GetResourceState('tgiann-inventory') ~= 'started' then return end
|
||||||
if ScriptUtility.Utility.Debug then print('DEBUG ENABLED : Inventory Set To qb-inventory') end
|
if ScriptUtility.Utility.Debug then print('DEBUG ENABLED : Inventory Set To tgiann-inventory') end
|
||||||
|
|
||||||
Inventory = {
|
Inventory = {
|
||||||
CanCarryItem = function(data)
|
CanCarryItem = function(data)
|
||||||
return true
|
return exports['tgiann-inventory']:CanCarryItem(data.src, data.item, data.amount or 1)
|
||||||
-- return exports['qb-inventory']:CanAddItem(data.src, data.item, data.amount or 1)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
CanCarryWeight = function(data)
|
CanCarryWeight = function(data)
|
||||||
return "old_check"
|
-- tgiann has a specific function for this
|
||||||
|
return exports['tgiann-inventory']:CanCarryWeight(data.src, data.weight or 0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
GiveItem = function(data)
|
GiveItem = function(data)
|
||||||
exports['qb-inventory']:AddItem(data.src, data.item, data.amount or 1, data.slot or nil, data.metadata or nil)
|
exports['tgiann-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)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
RemoveItem = function(data)
|
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)
|
local success = exports['tgiann-inventory']:RemoveItem(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], 'remove', data.amount or 1)
|
|
||||||
return success
|
return success
|
||||||
end,
|
end,
|
||||||
|
|
||||||
GetPlayerInventory = function(data)
|
GetPlayerInventory = function(data)
|
||||||
return Framework.GetFrameworkInventory(data.src)
|
return exports['tgiann-inventory']:GetPlayerItems(data.src)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
GetItemCount = function(data)
|
GetItemCount = function(data)
|
||||||
local item = exports["qb-inventory"]:GetItemsByName(data.src, data.item)
|
local items = exports["tgiann-inventory"]:GetItemsByName(data.src, data.item)
|
||||||
return item
|
local count = 0
|
||||||
|
if items then
|
||||||
|
for _, item in pairs(items) do
|
||||||
|
count = count + item.amount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return count
|
||||||
end,
|
end,
|
||||||
|
|
||||||
GetItemBySlot = function(data)
|
GetItemBySlot = function(data)
|
||||||
return exports["qb-inventory"]:GetItemBySlot(data.src, data.slot)
|
return exports["tgiann-inventory"]:GetItemBySlot(data.src, data.slot)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue