Client

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

Client functions

Here there are built-in exports of jaksam's inventory that can be used client-side

getTotalItemAmount

Gets the total amount of a specific item in the player's inventory

exports['jaksam_inventory']:getTotalItemAmount(itemName, metadata)

Parameters

  • itemName: string

    • The name of the item to count

  • metadata: table (optional)

    • Metadata to match against when counting (if provided, only items with the same metadata AND name will be counted)

Returns

  • totalAmount: number

    • Total amount of the item in the player's inventory

Example

openInventory

Opens an inventory alongside the player's inventory

Parameters

  • inventoryId: string

    • The ID of the inventory to open

Returns

None - Opens the inventory UI if successful

Example

closeInventory

Closes the inventory UI. Can either close a specific inventory or close the entire inventory UI

Parameters

  • inventoryId: string | nil

    • If provided, removes only the specified inventory from the UI

    • If nil, closes the entire inventory UI and all open inventories

Returns

None

Example

getInventory

Gets the player's self inventory

Parameters

None

Returns

  • inventory: table

    • The player's self inventory

Example

getItemByName

Returns the first item found in the player's self inventory by name (order not guaranteed)

Parameters

None

Returns

  • item: table

    • The item found in the player's self inventory

  • slotId: number

    • The slot ID of the item in the player's self inventory

Example

getItemsByName

Returns all items that match a specific item name from the player's inventory. Unlike getItemByName which returns only the first match, this function returns all occurrences with their slot numbers

Parameters

  • itemName: string

    • The name of the items to search for in the player's inventory

Returns

  • items: table

    • Array of all items matching the name. Each item includes the slot number. Returns empty table if no items found

    • Item structure:

Example

getItemFromSlot

Gets an item from a specific slot in the player's inventory

Parameters

  • slotId: number

    • The slot number to get the item from (in the player's inventory)

Returns

  • item: table | nil

    • The item in the slot, or nil if the slot is empty

    • Item structure:

Example

showHotbar

Shows the hotbar UI with the first 5 slots of the player's inventory

Parameters

None

Returns

None - Shows the hotbar UI which automatically hides after 2 seconds

Example

Notes:

  • The hotbar shows slots 1-5 from the player's inventory

  • If config.dynamicHotbar is true, empty slots at the end are hidden

  • The hotbar automatically hides after 2 seconds

  • Multiple calls reset the hide timer

setHotbarDisabled

Enables or disables the hotbar functionality. Useful for example during minigames. Don't forget to re-enable the hotbar when finished

Parameters

  • disabled: boolean

    • If true, the hotbar will be disabled and showHotbar() calls will be ignored

    • If false, the hotbar will be enabled and will work normally

Returns

None

Example

setHotkeysEnabled

Enables or disables the hotkeys functionality (slots 1-5). Useful for example during minigames or cutscenes. Don't forget to re-enable the hotkeys when finished

Parameters

  • enabled: boolean

    • If true, the hotkeys will be enabled and will work normally

    • If false, the hotkeys will be disabled and pressing 1-5 will be ignored

Returns

None

Example

areHotkeysEnabled

Returns whether the hotkeys are currently enabled or disabled

Parameters

None

Returns

  • enabled: boolean

    • True if hotkeys are enabled, false if disabled

Example

dequipWeapon

Deequips the currently equipped weapon

Parameters

  • skipSync: boolean (optional)

    • If true, the weapon will be deequipped without syncing the ammo to the server

Returns

None - Deequips the currently equipped weapon

Example

setWeaponWheel

Enables or disables the weapon wheel and related weapon settings. Useful for minigames where you want the GTA 5 weapon wheel. Note that this function will prevent using weapons from the inventory, it's mainly for FFA minigames

Parameters

  • state: boolean | nil

    • If true, the default GTA5 weapon wheel will be enabled and weapons WON'T be handled by jaksam inventory

    • If false, the default GTA5 weapon wheel will be disabled and weapons WILL be handled by jaksam inventory

    • If nil, uses the current internal state

Returns

None - Automatically deequips the current weapon when called

Example

registerActionButton

Registers a custom action button in the inventory UI toolbar. Action buttons appear on the right side of the inventory and can trigger any custom logic when clicked

For a complete guide with images and examples, see the Action Buttons Guide.

Parameters

  • id: string

    • Unique identifier for the button. Used to reference the button when showing/hiding/unregistering

  • icon: string

    • Bootstrap Icons class name (e.g. "bi-shield-x", "bi-car-front-fill"). Find icons at https://icons.getbootstrap.com/

  • tooltip: string | nil

    • Tooltip text shown when hovering the button. Can be nil for no tooltip

  • onClick: function

    • Callback function executed when the button is clicked

  • visible: boolean | nil

    • Whether the button should be visible initially. Default: true

Returns

None

Example

unregisterActionButton

Removes a previously registered action button from the inventory UI

Parameters

  • id: string

    • The unique identifier of the button to remove (same id used in registerActionButton)

Returns

None

Example

showActionButton

Makes a previously hidden action button visible in the inventory UI

Parameters

  • id: string

    • The unique identifier of the button to show

Returns

None

Example

hideActionButton

Hides an action button from the inventory UI without removing it

Parameters

  • id: string

    • The unique identifier of the button to hide

Returns

None

Example

getVehicleInventoryLimits

Returns the trunk or glovebox limits for a vehicle based on model. Uses the configuration from _data/vehicles.lua with priority: trunkByModel/gloveboxByModel > trunkByClass/gloveboxByClass. Returns 0, 0 if the vehicle/class is configured to not have trunk/glovebox (noTrunkVehicles, noTrunkClasses, etc.)

Parameters

  • vehicleModel: number|string

    • The vehicle model hash (from GetEntityModel) or the model name as string

  • inventoryType: string

    • Either "trunk" or "glovebox"

Returns

  • maxSlots: number|nil

    • The maximum slots for the vehicle inventory, or nil if no config found

  • maxWeight: number|nil

    • The maximum weight for the vehicle inventory, or nil if no config found

Example

isInventoryOpen

Checks if an inventory is currently open. If no inventory ID is provided, returns whether the inventory UI is currently active (any inventory open). If an inventory ID is provided, checks if that specific inventory is open

Parameters

  • inventoryId: string | nil

    • The ID of the inventory to check

    • If nil, returns whether any inventory UI is currently active

Returns

  • isOpen: boolean

    • True if the inventory (or any inventory UI when inventoryId is nil) is open, false otherwise

Example

setInventoryDisabled

Completely disables or re-enables inventory opening. When disabled, all inventory interactions are blocked: hotkeys, keybinds, and direct export/event calls. If the inventory is currently open when disabling, it will be closed and the weapon will be dequipped automatically

This is useful for cutscenes, minigames, progress bars, or any scenario where the player should not be able to open the inventory.

Parameters

  • disabled: boolean

    • If true, inventory opening is completely blocked

    • If false, inventory opening is re-enabled

Returns

None

Example

ox_inventory compatibility

If you are migrating from ox_inventory, this export replaces the invBusy state bag pattern. Scripts that set LocalPlayer.state:set('invBusy', true, true) will continue to work automatically - jaksam_inventory listens for invBusy state bag changes and maps them to the same internal flag.

isInventoryDisabled

Returns whether inventory opening is currently disabled

Parameters

None

Returns

  • disabled: boolean

    • True if inventory opening is currently disabled, false otherwise

Example

Last updated