oxserver
ox_inventory:RemoveItem
ox server documentation with a FiveM Lua example.
Summary
Removes an item from an inventory via ox_inventory's server export. Use it to take items when a player sells, uses, or trades.
Returns
boolean — whether the removal succeeded.
Parameters
invnumber|stringThe inventory id — usually the player's server ID.itemstringThe item name.countnumberHow many to remove.Example
-- SERVER
local removed = exports.ox_inventory:RemoveItem(src, 'water', 1)
if removed then
-- proceed (e.g. give money for the sale)
endCommon pitfalls
- Always check the return — if the player doesn't have the item, removal fails and you shouldn't give the reward.
- Do the remove-then-reward sequence server-side and check each step, or players can exploit it.
Related functions
Related guides
Managing jobs on your server?
Viper Multi-Job lets players hold several jobs and switch between them with grade, salary and duty handled — QBCore, QBox and ESX, validated server-side.
See Viper Multi-Job →