Exports
Public exports exposed by wasabi_inventory.
The resource folder must be named wasabi_inventory for these examples to work unchanged.
Client exports​
Opening and closing​
exports.wasabi_inventory:openInventory(invType, data)
exports.wasabi_inventory:openNearbyInventory()
exports.wasabi_inventory:closeInventory()
Supported openInventory types are player, stash, shop, drop, trunk, and glovebox. Omit both arguments to open the local player's inventory.
For vehicle storage, pass a table with a valid network ID (netId; netid is also accepted), not a plate string or local entity handle:
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle ~= 0 then
local opened = exports.wasabi_inventory:openInventory('glovebox', {
netId = NetworkGetNetworkIdFromEntity(vehicle),
})
end
Use 'trunk' with the network ID of the nearby vehicle for trunk access. Normal server checks require proximity, being inside that vehicle for a glovebox, or being outside vehicles with an accessible unlocked trunk. Model rules and capacities still apply. Optional plate, model, and class fields are accepted; omit them unless your trusted integration needs to supply them. The client derives model/class when omitted, and the server resolves the plate from the entity. Returns true on a successful open and false when opening is rejected.
Item use and search​
exports.wasabi_inventory:useItem(data, callback, noAnimation)
exports.wasabi_inventory:useSlot(slot, noAnimation)
local result = exports.wasabi_inventory:Search(searchMode, item, metadata)
local count = exports.wasabi_inventory:GetItemCount(itemName, metadata, strict)
local slot = exports.wasabi_inventory:GetSlotWithItem(itemName, metadata, strict)
local slotId = exports.wasabi_inventory:GetSlotIdWithItem(itemName, metadata, strict)
local slots = exports.wasabi_inventory:GetSlotsWithItem(itemName, metadata, strict)
Search accepts count or slots as its search mode and supports one item name or multiple names.
Player inventory state​
local items = exports.wasabi_inventory:GetPlayerItems()
local weight = exports.wasabi_inventory:GetPlayerWeight()
local maxWeight = exports.wasabi_inventory:GetPlayerMaxWeight()
Weapons and player actions​
local weapon = exports.wasabi_inventory:getCurrentWeapon()
exports.wasabi_inventory:weaponWheel(false)
exports.wasabi_inventory:giveItemToTarget(targetServerId, slotId, count)
Definitions, metadata, and UI helpers​
local definition = exports.wasabi_inventory:Items('water')
local allItems = exports.wasabi_inventory:ItemList()
exports.wasabi_inventory:displayMetadata('serial', 'ABC123')
exports.wasabi_inventory:notify({ type = 'success', description = 'Done' })
exports.wasabi_inventory:suppressItemNotifications(true)
Items and ItemList are aliases. displayMetadata accepts one key/value pair or a metadata table.
Progress and input compatibility​
local completed = exports.wasabi_inventory:Progress(options)
exports.wasabi_inventory:CancelProgress()
local active = exports.wasabi_inventory:ProgressActive()
local result = exports.wasabi_inventory:Keyboard(...)
Server exports​
Framework inventory loading​
exports.wasabi_inventory:setPlayerInventory(player, data)
Loads or reloads a framework player inventory through the same path used by the built-in bridges. player must be a table containing source; optional fields include identifier, name, and groups. data is an optional persisted slot array. Most integrations should let the active framework bridge load players automatically.
Inventory lookup​
local inventory = exports.wasabi_inventory:Inventory(inv, owner)
local inventory = exports.wasabi_inventory:GetInventory(inv, owner)
local items = exports.wasabi_inventory:GetInventoryItems(inv, owner)
inv may be a loaded player source or another loaded inventory identifier. Inventory and GetInventory are aliases.
Add, remove, and set items​
local success, response = exports.wasabi_inventory:AddItem(inv, item, count, metadata, slot)
local success, response = exports.wasabi_inventory:RemoveItem(inv, item, count, metadata, slot)
local success, response = exports.wasabi_inventory:SetItem(inv, item, count, metadata)
Always check the returned success value before assuming a mutation completed.
Query items and slots​
local item = exports.wasabi_inventory:GetItem(inv, itemName, metadata, returnsCount)
local count = exports.wasabi_inventory:GetItemCount(inv, itemName, metadata, strict)
local result = exports.wasabi_inventory:Search(inv, searchMode, items, metadata)
local slot = exports.wasabi_inventory:GetSlot(inv, slotId)
local slot = exports.wasabi_inventory:GetSlotWithItem(inv, itemName, metadata, strict)
local slotId = exports.wasabi_inventory:GetSlotIdWithItem(inv, itemName, metadata, strict)
local slots = exports.wasabi_inventory:GetSlotsWithItem(inv, itemName, metadata, strict)
local slotIds = exports.wasabi_inventory:GetSlotIdsWithItem(inv, itemName, metadata, strict)
local empty = exports.wasabi_inventory:GetEmptySlot(inv)
local targetSlot = exports.wasabi_inventory:GetSlotForItem(inv, itemName, metadata)
local slots, totalCount, emptySlots = exports.wasabi_inventory:GetItemSlots(inv, itemName, metadata)
Capacity and metadata​
exports.wasabi_inventory:SetMetadata(inv, slotId, metadata)
exports.wasabi_inventory:SetDurability(inv, slotId, durability)
exports.wasabi_inventory:SetMaxWeight(inv, maxWeight)
exports.wasabi_inventory:SetSlotCount(inv, slots)
local canCarry = exports.wasabi_inventory:CanCarryItem(inv, item, count, metadata)
local canCarry, freeWeight = exports.wasabi_inventory:CanCarryWeight(inv, weight)
local amount = exports.wasabi_inventory:CanCarryAmount(inv, item)
local canSwap = exports.wasabi_inventory:CanSwapItem(inv, firstItem, firstCount, testItem, testCount)
Clear and definitions​
exports.wasabi_inventory:ClearInventory(inv, keep)
local item = exports.wasabi_inventory:Items(itemName)
local allItems = exports.wasabi_inventory:ItemList()
Drops​
local dropId = exports.wasabi_inventory:CustomDrop(
'Reward',
{ { name = 'water', count = 2 } },
vector3(100.0, 100.0, 30.0),
10,
25000,
nil,
'prop_box_wood02a_pu'
)
local dropId = exports.wasabi_inventory:CreateDropFromPlayer(playerId)
Usable item callback​
exports.wasabi_inventory:registerUsableItem('radio', function(inventoryId, item, context)
print(('Used slot %s'):format(context.slot))
end, function(inventoryId, item, context)
return true -- return false to cancel before use
end)
Shops and stashes​
exports.wasabi_inventory:RegisterShop(shopType, details)
exports.wasabi_inventory:RegisterStash(name, label, slots, maxWeight, owner, groups, coords)
local tempId = exports.wasabi_inventory:CreateTemporaryStash(properties)
exports.wasabi_inventory:OpenInventory(playerId, stashId, owner)
local openedId = exports.wasabi_inventory:forceOpenInventory(playerId, invType, data, ignoreSecurity)
exports.wasabi_inventory:RemoveInventory(inventoryOrId)
forceOpenInventory is intended for trusted server resources. It can bypass normal stash or player-search checks when ignoreSecurity is enabled.
For trunk and glovebox, supply a table containing netId (or netid). The current vehicle branch always bypasses the vehicle opening security checks, regardless of the export's ignoreSecurity argument. A live entity, loaded player, and supported vehicle capacity are still required. Validate the caller, vehicle, and authorization in your server resource; never forward unrestricted client requests to this export.
Vehicle plate changes​
local updated = exports.wasabi_inventory:UpdateVehicle(oldPlate, newPlate)
Server only. Remaps currently loaded trunk/glovebox inventories and their active viewers from the old plate key to the new one. Plates are uppercased and, by default, stripped of whitespace according to Config.TrimVehiclePlate.
Returns false for empty plates or equal normalized plates; otherwise returns true, even if no matching inventory was loaded. This is no longer a compatibility stub.
This export does not change the vehicle entity's plate or update the garage/framework database row. Your garage must perform those changes itself and coordinate this export with them. It adjusts matching string-based persistence keys; numeric owned-vehicle IDs are retained. Test plate changes with open storage and after a restart before enabling a garage integration.
Current weapon​
local weapon = exports.wasabi_inventory:GetCurrentWeapon(playerId)
See Hooks and Events for registerHook and removeHooks.