ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
oxserver

ox_inventory hooks (registerHook)

ox server documentation with a FiveM Lua example.

Summary

Register hooks that fire on inventory actions (swap, use, buy) in ox_inventory — the modern way to gate or react to item movement.

Returns

void

Example

exports.ox_inventory:registerHook('swapItems', function(payload)
  -- inspect/deny the swap
  return true
end)

Common pitfalls

  • Requires ox_inventory.
  • Return false to deny an action.
  • Keep hook logic fast; it runs on inventory operations.

Related functions

Related guides

FiveM scripts done right

Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.

Browse Scripts →