Bridges
Everything framework-specific lives in bridge/, outside escrow protection. If your server runs something not supported out of the box, you can add it yourself by dropping in one file.
bridge/
βββ framework/ qb, esx
βββ inventory/ ox_inventory, qb-inventory, ak47_inventory, origen_inventory
βββ notification/ ox_lib, qb, esx, okokNotify, ps-ui
βββ progressbar/ ox_lib, qb, esxEach file guards itself: it checks cfg and the running resources, and returns early if it is not the right one. Only one bridge per category ever binds.
Framework bridge
Provides player lookup and usable-item registration.
function registerUsableItem(item, cb) -- cb(playerId)
function getPlayerIdentifier(playerId) -- stable unique string
function getPlayer(playerId)getPlayerIdentifier is used as the SQL ammo key, so it must be stable across sessions. Returning something session-scoped would reset ammo on every reconnect.
Inventory bridge
Provides item access, and declares whether metadata ammo is possible.
inventoryName = 'ox_inventory'
inventorySupportsMetadata = true
function getItemMetadata(playerId, item) --> metadata, slot
function setItemMetadata(playerId, item, slot, meta) --> boolean
function getItemCount(playerId, item) --> number
function removeItem(playerId, item, count) --> booleanSetting inventorySupportsMetadata = false is legitimate. The ammo system falls back to SQL automatically. Only the last two functions are then required.
Writing your own
Create bridge/inventory/myinventory.lua:
The glob in fxmanifest.lua picks up any .lua in the folder, so no manifest edit is needed.
Keep the auto-detect guard at the top. Without it your bridge binds even when a different inventory is configured, and whichever file loads last wins.
Notification bridge
type is one of 'success', 'error', 'inform'.
Unlike the others, notifications are not auto-detected, so set cfg.notification to match your server.
Progress bar bridge
Shown while equipping a dual gun or loading ammo, for cfg.progress_duration_ms. The action cannot be cancelled.
Load order
The manifest loads bridges before the main scripts, in this order:
This is why the ammo mode line appears in your console at start-up: by then the inventory bridge has already declared its capabilities.
Last updated