itemAdded
The qb-inventory:server:itemAdded
and qb-inventory:client:itemAdded
events are triggered whenever an item is added to a player's inventory. You can use these events to implement custom logic when specific items are added.
The event has the prefix "qb-" for automatic integration to qbcore.
Event Structure (Server-Side)
Event Structure (Client-Side)
Parameters
source: The player's source ID (integer).
item: The item name being added (string).
amount: The quantity of the item being added (integer).
totalAmount: The total quantity of the item in the inventory after the addition (integer).
Basic Example: Detect Specific Item Addition
Server-Side
Client-Side
Implementation Steps
Place the server-side code in a server-side Lua file and the client-side code in a client-side.
Match the
item
parameter with the item names defined in your inventory system.Add any custom functionality, such as notifications, logging, or effects, as needed.
These events are simple yet powerful tools for extending your inventory system with custom logic when items are added.
Last updated