Shared
Compatibility
This script works with other popular inventory systems, like es_extended, qb-inventory, and ox_inventory
For ESX and QBCore functions, the setup is done automatically. But, if you want to keep using exports from ox_inventory or qb-inventory for compatibility, you need to turn on this option in the file: jaksam_inventory/integrations/sv_integrations.lua
Shared functions
Here there are built-in exports of jaksam's inventory, works both on server and client
getStaticItemsList
Returns the list of all items in the inventory
exports['jaksam_inventory']:getStaticItemsList()Returns
items: tableThe list of items, key is the item name, value is item information (label, maxStack, weight, stackable, description, rarity, type, etc.)
Example
-- Get the list of items
local items = exports['jaksam_inventory']:getStaticItemsList()
local weaponsCount = 0
for itemName, item in pairs(items) do
if item.type == 'weapon' then
weaponsCount = weaponsCount + 1
end
end
print("There are in total " .. weaponsCount .. " registered weapons in the inventory")getStaticItem
Gets generic item information from the inventory, like weight, stackable, description, label, etc.
Parameters
itemName: stringThe name of the item to get
Returns
item: tableThe item information, if the item is not found, it will return nil
Example
getItemLabel
Gets only the label (display name) of an item. This is a simpler and faster alternative to getStaticItem when you only need the item's label
Parameters
itemName: stringThe name of the item to get the label for
Returns
label: string|nilThe label (display name) of the item, or nil if the item is not found
Example
getItemImagePath
Gets the NUI image path for an item. The function uses a fallback system: first checks if the item has a custom image field, then tries to find .png or .webp files, and finally falls back to the default box.webp image
Parameters
itemName: stringThe name of the item to get the image path for
Returns
imagePath: stringThe NUI image path (e.g., "nui://jaksam_inventory/_images/bread.png"). Always returns a valid path, using fallback to
box.webpif the item doesn't exist or no image is found
Example
Last updated
Was this helpful?