Adding Items
Guide for Adding Items
If you need assistance, please reach out to a developer, as the setup for "Basic Item Declaration" is designed to be straightforward. However, if any difficulties arise, it’s best to consult a trusted developer to ensure a smooth integration.
To correctly set up items in qs-inventory, follow these instructions and examples. Note that this file is compatible with ESX. If using QBCore, move this file to qb-core/shared
and rename the main function accordingly.
This configuration works in both qb-core/shared/items.lua
for QBCore and qs-inventory/shared/items.lua
for ESX (the latter only applies to ESX setups). You can use these examples and combine various features—such as rarities, consumables, props, and item animations—to create custom items tailored to your server’s needs. By mixing these options, you can design unique, functional items that enhance player experience and gameplay dynamics.
Basic Item Declaration
Each item has essential properties that determine its behavior. Here are the primary fields for setup:
name: Unique ID for the item.
label: Display name in the inventory.
weight: Weight of the item in kg.
type: Item type (
item
orweapon
).image: Name of the image file in
html/images/
.unique:
true
if the item is non-stackable;false
if it can stack.useable:
true
if the item can be used.shouldClose:
true
if the inventory should close when the item is used.description: Short description of the item.
Example:
Decay (Wear and Tear)
Certain items degrade with use.
decay: Sets the rate of wear. The higher the value, the faster it wears out.
delete:
true
to remove the item when it breaks.
Wear and Tear Example:
Visible Object
If you don't have an item set, it will show a simple bag.
This will set a specific prop, when giving the item, throwing it or doing throw, this item will be seen in the game. You can configure an item to be thrown as an object.
object: Model of the object that will be thrown.
Throwable Object Example:
Item Rarity
The rarity of an item changes the color of the item in the inventory.
rare: Sets the item rarity (
common
,epic
,legendary
), which only affects the color of the item in the inventory.
Rarity Example:
Object with export
We can add a client export as follows.
export: Sets an export as usability.
Export Example:
Internal Export Example:
Consumables
Please if you are not an experienced programmer, just skip this step and continue adding your consumable items in esx_basicneeds or qb-smallresources.
For this to work in esx we must have esx_status and esx_basicneeds.
Consumable items can affect thirst or hunger and may include animations, visible objects, and movement restrictions.
thirst/hunger: Defines whether it affects thirst or hunger.
usetime: Duration of use in ms.
anim: Animation dictionary and clip.
prop: Model and coordinates of the object during the animation.
disable: Disables events (movement, combat, etc.).
removeAfterUse:
true
deletes the item after use.
Consumable Example:
Complete Examples
Items such as "tosti" and "water_bottle" serve as basic examples that include all the properties and functionalities discussed here. Use these examples along with the above guidelines to customize and adapt the items.lua
file to fit your requirements.
Last updated
Was this helpful?