NEEDS TESTED -- Core Inventory
This commit is contained in:
1 parent
322516854b
commit
663e3bc9c1
2 files changed
+22
-1
No files matched your search
@@ -13,4 +13,20 @@ Inventory.GetImagePath = function(item)
|
||||
local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item))
|
||||
local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
Inventory.GetItemInfo = function(item)
|
||||
local frameworkName = Framework.GetFrameworkName()
|
||||
if not frameworkName then return {} end
|
||||
local dataRepack = {}
|
||||
if frameworkName == 'es_extended' then
|
||||
local callbackData = lib.callback.await('community_bridge:Callback:core_inventory', false)
|
||||
-- really really wish this inventory allowed me to pull the item list client side....
|
||||
dataRepack = callbackData[item]
|
||||
if not dataRepack then return {} end
|
||||
elseif frameworkName == 'qb-core' then
|
||||
dataRepack = Framework.Shared.Items[item]
|
||||
if not dataRepack then return {} end
|
||||
end
|
||||
return {name = dataRepack.name, label = dataRepack.label, stack = dataRepack.stack, weight = dataRepack.weight, description = dataRepack.description, image = Inventory.GetImagePath(dataRepack.name) }
|
||||
end
|
||||
@@ -34,4 +34,9 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
lib.callback.register('community_bridge:Callback:core_inventory', function(source)
|
||||
local items = core:getItemsList()
|
||||
return items or {}
|
||||
end)
|
||||
Reference in new issue
Block a user