NEEDS TESTED -- Core Inventory
This commit is contained in:
1 parent
322516854b
commit
663e3bc9c1
2 files changed
+21
No files matched your search
@@ -14,3 +14,19 @@ Inventory.GetImagePath = function(item)
|
|||||||
local imagePath = file and string.format("nui://core_inventory/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"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
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
|
||||||
@@ -35,3 +35,8 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
|||||||
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
return true
|
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