Inventory Integration

✅ ox_inventory and qs-inventory already integrated with rm_houserobbery.

qb-inventory Integration

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

Add Item Events to qb-inventory

To add item-related events to qb-inventory, follow these steps:

1. Modifying the AddItem Function

In 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

TriggerEvent('qb-inventory:server:itemAdded', identifier, item, amount, updated or amount)
TriggerClientEvent('qb-inventory:client:itemAdded', identifier, item, amount, updated or amount)

2. Modifying the RemoveItem Function

Similarly, 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:

TriggerEvent('qb-inventory:server:itemRemoved', identifier, item, amount, inventoryItem.amount)
TriggerClientEvent('qb-inventory:client:itemRemoved', identifier, item, amount, inventoryItem.amount)

Custom Inventory

Steps to Integrate Your Custom Inventory Script

  1. Assign Events to Functions: In your custom inventory script, place the events for the AddItem and RemoveItem functions at the appropriate locations as specified.

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

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

Last updated