# Items and weapons on ESX Legacy

> How ESX Legacy handles items and weapons: the items table, inventory weight, xPlayer.addWeapon, Config.Weapons, the loadout column and the ox_inventory switch.

Source: https://fam-tools.com/guides/esx-items-and-loadout · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 9 min

**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.

## Key points

- Items: database `items` table.
- Weapons: player loadout, not items (default ESX).
- Component names like `suppressor` come from `Config.Weapons`.
- `Config.MaxWeight` sets the carry limit.
- ox_inventory replaces the loadout with weapon items.

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

*Adding an item*

```sql
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](https://pityus.net/guides/esx-legacy-script-tutorial).

## Weapons and the loadout

*server.lua*

```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](https://fam-tools.com/guides/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](https://fam-tools.com/guides/ox-inventory-weapons-data) and [inventory systems compared](https://fam-tools.com/guides/fivem-inventory-systems-compared).

## 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`.

## Related

- https://fam-tools.com/guides/esx-weapon-setup
- https://fam-tools.com/guides/fivem-inventory-systems-compared
- https://fam-tools.com/guides/ox-inventory-weapons-data
- https://fam-tools.com/guides/fivem-give-weapon-to-player
