Client exports
Call them on exports['koja-inventory-v2'].
Always available
| Export | Description |
|---|---|
SyncClothing() | Reads what the character wears right now and syncs it into the clothing slots immediately, without waiting for the watcher. Call it after your script changes clothes. |
RegisterSearchCheck(function() end) | Client side of the frisk check for the local player. Return true to allow being frisked, false to block, nil for the default checks. |
IsSearching() | true while the local player is frisking someone. |
After a job wardrobe
SetPedComponentVariation(PlayerPedId(), 11, 55, 0, 0)
exports['koja-inventory-v2']:SyncClothing()Native mode (Config.Ox.enabled = false)
| Export | Description |
|---|---|
OpenInventory(type, data) | 'stash', name, 'player', serverId, or a payload table like { type = 'shop', name = 'general', index = 1 }. |
CloseInventory() | Closes the inventory. |
IsOpen() | true while the inventory is open. |
GetPlayerItems() | { id, name, count, metadata, container } for every item the player carries. |
OpenNearbyInventory() | Frisks the player in front, same as /frisk. |
GetCurrentWeapon() | The drawn weapon or nil. |
ox mode (Config.Ox.enabled = true, default)
The client answers the ox_inventory client API, both as exports['koja-inventory-v2'] and as exports.ox_inventory:
openInventory, closeInventory, openNearbyInventory, Items, Search, GetItemCount, GetPlayerItems, GetPlayerWeight, GetPlayerMaxWeight, GetSlotWithItem, GetSlotsWithItem, GetSlotIdWithItem, GetSlotIdsWithItem, getCurrentWeapon, useSlot, useItem, giveItemToTarget(serverId, slot, count), weaponWheel(state), IsOpen, OpenInventory, CloseInventory.
giveItemToTarget sends a normal give offer: the receiver gets the accept or decline window.
State bags and events
| Name | Side | Description |
|---|---|---|
LocalPlayer.state.invOpen | client | true while the inventory is open. |
LocalPlayer.state.invBusy | client | true while a progress bar (use, craft, repair) runs. |
ox_inventory:currentWeapon | client event | Fired with the weapon data when a weapon is drawn, nil when holstered. |
koja-inventory-v2:client:slotChanged | client event | key, item | nil when one of your equipment slots changes. |
koja-inventory-v2:client:settingsChanged | client event | List of config paths changed in the admin panel. |