Create a usable item in ox_inventory (and qs-inventory)
An item in a FiveM inventory is not magic. It is one row in a Lua table that you edit by hand. Get the shape right and the inventory draws an icon, shows a tooltip, plays an animation on use, and lets you hand it out with the built-in give command. Get the shape wrong and the slot is blank, the item does not stack, or the inventory rejects it with invalid_item. By the end you will have a working water item in ox_inventory, you will give it to yourself from the server console with /giveitem, and you will be able to read the qs-inventory version and name every difference.
Two inventories, one idea
Before you touch a file, fix one thing in your head. ox_inventory and qs-inventory are different resources made by different people, and they store items in different files with different field names. But the idea is identical in both: an item is a key in a Lua table, and the value is a config table that describes the item.
- ox_inventory is Overextended's free, open-source, slot-based inventory. Items live in
data/items.lua. You can read its source on GitHub. - qs-inventory is Quasar Store's paid, encrypted inventory (it supports ESX, QBCore, and Qbox). Where its items live depends on your framework: on QBCore it reads
qb-core/shared/items.lua(you edit qb-core's item list, not a file inside qs-inventory), while on standalone or ESX it uses qs-inventory's own items file. Either way the shape is QBCore-style. There is no public source to read, only the docs.
This lesson builds the item in ox_inventory first because it is free and open, so you can verify every claim against the real source. Then it maps the same item onto qs-inventory.
Where each inventory's items live
Three common inventories, three different homes for the item list. Note that qs-inventory does not always own its own file; on QBCore it borrows qb-core's.
| Inventory | Items file | Item fields / key | Icon folder |
|---|---|---|---|
| ox_inventory | ox_inventory/data/items.lua | key = item name | ox_inventory/web/images/<name>.png (filename = item name) |
| qb-inventory | qb-core/shared/items.lua | name / label / weight / type / image / unique / useable / description | qb-inventory/html/images/ |
| qs-inventory | qb-core/shared/items.lua on QBCore; qs-inventory's own items file on standalone/ESX | QBCore-style flat fields (name / label / weight / type / image / unique / useable) | qs-inventory/html/images/ |
Give an item without code
Once an item exists in the items file, you do not need to write a script just to hand one out. Every major inventory ships a built-in admin command:
/giveitem [id] [item] [count]
Run it from the server console or in game as an admin. [id] is the target player's server id, [item] is the item key, and [count] is how many. Most inventories also expose an in-game admin menu that gives items by clicking. This built-in command is ACE-gated, so grant it to your admin group before an in-game admin can use it, for example add_ace group.admin command.giveitem allow.
That built-in command (or the admin menu) is the owner path: no code, just an item that already exists. Writing your own command resource is the developer path. You only need the developer path when you want custom logic (a capacity pre-check, a cost, a cooldown) around handing out the item. To simply give an item, reach for /giveitem first.
Keep reading the full lesson
Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.
- Build it in ox_inventory
- How it works
- The qs-inventory equivalent
- Common mistakes
- What you can do now
- Try it yourself
The remainder of Creating items for ox and qs inventory is available to FiveM School members.