Events
All server events are emitted with TriggerEvent (server-local). Subscribe from any other server resource.
inventoryId, fromInventory, toInventory) is string | number: a number (the player's server id) when the inventory belongs to a player, otherwise the internal string id (stash:<name>, trunk:<plate>, ...).onItemAdded
Fires after an item is added to any inventory.
RegisterNetEvent('one_inventory:onItemAdded', function(payload) end)
nil for non-player inventories.player, stash, trunk, ...).nil if the item is unknown.onItemRemoved
Fires after an item is removed from any inventory.
RegisterNetEvent('one_inventory:onItemRemoved', function(payload) end)
nil for non-player inventories.onItemUsed
Fires after a player uses or consumes an item (status effects applied, durability ticked).
RegisterNetEvent('one_inventory:onItemUsed', function(payload) end)
onItemSwapped
Fires after items are swapped between slots or between inventories.
RegisterNetEvent('one_inventory:onItemSwapped', function(payload) end)
nil for a programmatic move, e.g. one made through the SwapSlots export.nil when the target slot was empty (a move).move (target empty), stack (same stackable item), or swap (different items).source identifies the acting player, not "which inventory changed". To determine that, read the per-side fromInventory / toInventory and fromType / toType instead: source can be nil for programmatic moves, and for a transfer triggered by another player it identifies that player rather than either side of the swap.onShopPurchased
Fires after a successful shop purchase (currency charged, stock decremented, item added).
RegisterNetEvent('one_inventory:onShopPurchased', function(payload) end)
cash, black_money, custom).shop.shopId.item.onItemCrafted
Fires after a craft succeeds (ingredients consumed, output added).
RegisterNetEvent('one_inventory:onItemCrafted', function(payload) end)
bench.onItemDropped
Fires after an item is dropped on the ground.
RegisterNetEvent('one_inventory:onItemDropped', function(payload) end)
onItemGiven
Fires after a player-to-player item transfer.
RegisterNetEvent('one_inventory:onItemGiven', function(payload) end)
onInventoryOpened
Fires after an inventory UI successfully opens.
RegisterNetEvent('one_inventory:onInventoryOpened', function(payload) end)
stash, shop, crafting, vehicle, dumpster, drop, player, or nil when only the player's own inventory is open.secondaryType: a plate-prefixed id (trunk:<plate> / glovebox:<plate>) for vehicle, the target's server id for player, and a raw unprefixed name/id (stash name, shop name, bench name, drop id, dumpster id) for the rest.onInventoryClosed
Fires after an inventory UI closes.
RegisterNetEvent('one_inventory:onInventoryClosed', function(payload) end)
onDefinitionsUpdated
Fires after any item-like definition (item, weapon, ammo, component, container, or clothing) is created, edited, or deleted from any source (admin panel, file import, migration, the CreateItemsDefinition runtime export). Rapid bursts are coalesced into a single event.
AddEventHandler('one_inventory:onDefinitionsUpdated', function() end)
GetAllItemDefinitions.