ESXserver
xPlayer.addInventoryItem
ESX server documentation with a FiveM Lua example.
Summary
Adds an item to a player's inventory in ESX's native inventory. (On ox_inventory servers, use the ox_inventory exports instead.)
Returns
void
Parameters
itemstringThe item name.countnumberHow many to add.Example
local xPlayer = ESX.GetPlayerFromId(src)
xPlayer.addInventoryItem('bread', 1)Common pitfalls
- Item must exist in the ESX items table.
- On ox_inventory servers, use exports.ox_inventory:AddItem — don't mix inventory systems.
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 →