Inventorybeginner9 min readupdated 11 Sept 2026

Items and weapons on ESX Legacy

The short answer

Items are rows in the items table (name, label, weight, rare, can_remove) and are handled with xPlayer.addInventoryItem/removeInventoryItem. Weapons use the loadout: xPlayer.addWeapon('WEAPON_PISTOL', 50), addWeaponComponent(weapon, 'suppressor'), addWeaponAmmo, setWeaponTint — with names, components and tints defined in Config.Weapons, saved in users.loadout. With ox_inventory, weapons become items and data/weapons.lua takes over.

ESX Legacy keeps items and weapons apart. Items are rows in the database and live in the inventory; weapons are a loadout attached to the player, with ammo, attachments and tints stored alongside. Many servers replace this with ox_inventory, which turns weapons into items — so it matters which setup you are writing for.

Items and weapons on ESX Legacy — illustrated with a FiveM-compatible minimap render

#Items

Adding an item
INSERT INTO items (name, label, weight, rare, can_remove) VALUES ('fish', 'Fish', 1, 0, 1);

Carry capacity is Config.MaxWeight in es_extended’s config. Items are then given with xPlayer.addInventoryItem('fish', 1) — see the ESX tutorial.

#Weapons and the loadout

server.lua
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addWeapon('WEAPON_PISTOL', 50)
xPlayer.addWeaponComponent('WEAPON_PISTOL', 'suppressor')
xPlayer.addWeaponAmmo('WEAPON_PISTOL', 24)
xPlayer.setWeaponTint('WEAPON_PISTOL', 2)

if xPlayer.hasWeapon('WEAPON_PISTOL') then
    xPlayer.removeWeapon('WEAPON_PISTOL')
end

Component names (suppressor, clip_extended, flashlight) and tints come from Config.Weapons in es_extended’s shared config, which maps them to GTA component hashes. The loadout is saved in the users.loadout column.

#Add-on weapons on default ESX

Add the weapon to Config.Weapons (name, label, ammo type, tints, components) so addWeapon and shops accept it. Full steps: ESX weapon setup.

#With ox_inventory

ox_inventory supports ESX and replaces the loadout: weapons become items with metadata (serial, durability, components). ESX’s inventory functions are bridged, but weapons should then be given as items — see ox_inventory weapons.lua and inventory systems compared.

Share this guideXRedditFacebook

Questions

How do I add an item in ESX?
Insert a row into the items table (name, label, weight, rare, can_remove) and restart.
How do I give a weapon in ESX?
xPlayer.addWeapon('WEAPON_NAME', ammo) on the server (default ESX inventory).
Where are ESX weapons defined?
In Config.Weapons in es_extended’s shared config.
Do ESX loadout functions work with ox_inventory?
With ox_inventory, weapons are items — give them with exports.ox_inventory:AddItem.

Ready to pick a map?

Twelve themes on three base map styles, $8 each, instant download.

Relevant to what you just read

The tool for this

Twenty theme pairs for ox_lib and ox_inventory From $15, built in the browser, exported as a drop-in resource.

Look it up while you work

The reference tables this guide leans on, free and without an account.