qb-inventory has none: its item move is
an internal event with nothing to subscribe to. A product that needs the hook reports it and stops:
Outcome
qb-inventory publishes a RegisterOnSwapItems export, and products that watch item movement start
and work. The edit is around fifteen lines in two of its files. Nothing else on your server changes.
Only products that watch item movement need this. If no product reports the line above, you have
nothing to do here.
Prerequisites
qb-inventoryrunning on your server, and a copy of the two files you are about to edit.- The steps below are written against current
qb-inventoryfromqbcore-framework/qb-inventory. If yours is already a fork, the function names are the same but the line numbers are not. - Console access to restart
qb-inventoryand the product.
Steps
1. Add the export
Openqb-inventory/server/functions.lua and add this at the end of the file.
2. Call it from the move
Openqb-inventory/server/main.lua and find the handler for
qb-inventory:server:SetInventoryData. It starts like this:
getItem) and before
anything is added or removed, insert:
3. Restart
Verification
The product no longer reports the missing export when it starts. To confirm the hook fires, move an item into an inventory the product watches. A product that refuses the move leaves the item where it was.Next steps
What the product receives
The handler is called with one table, the same shape every supported inventory reports:
A handler that returns
false refuses the move. Any other return value (including no return at all)
allows it.
Keeping the edit
qb-inventory updates overwrite both files. After updating it, re-apply the two steps above; the
product reports the missing export again if you forget, so this fails loudly rather than silently.