Inventory Integration
Last updated
Last updated
This guide is for qb-inventory 2.0.0. If you are using an older version of qb-core, the AddItem and RemoveItem functions might be located in qb-core/server/player.lua or in any of the files within qb-inventory/server/.
To add item-related events to qb-inventory
, follow these steps:
AddItem
FunctionIn the file qb-inventory/server/functions.lua
, locate the AddItem
function. To trigger events when an item is added, insert the following code before the line return true
RemoveItem
FunctionSimilarly, locate the RemoveItem
function in qb-inventory/server/functions.lua
. Add the following lines of code before the return true
statement to trigger events when an item is removed:
Assign Events to Functions: In your custom inventory script, place the events for the AddItem
and RemoveItem
functions at the appropriate locations as specified.
Copy and Rename the File:
Navigate to the rm_houserobbery/bridge/inventory
folder.
Copy one of the existing inventory script files. (like qb-inventory)
Rename the copied file to match the name of your custom inventory script.
Update Event Names: Open the newly created file and replace the event names with the ones you assigned in Step 1.
That’s all! You now have your custom inventory script integrate.