attempt to make luke happy

Lazy and poorly "typed" shops guide.
Update AddItem and RemoveItem typings and improve examples.
Add hooks.
This commit is contained in:
Linden committed 2022-11-07 08:26:27 +11:00
1 parent 9f803f6a99
commit 2bfdefcc9d
4 files changed
+253 -42

No files matched your search

@@ -1,16 +1,27 @@
Removes the specified item from the specified inventory.
```lua
-- inv: string or table
-- item: table or string
-- count: number
-- metadata: table or string (optional)
-- slot: number (optional)
exports.ox_inventory:RemoveItem(inv, item, count, metadata, slot)
```
- inv: `table` or `string` or `number`
- The inventory's unique id, or a table with the id and owner.
- playerId: `1`, inventoryId: `gloveVGH283`, `{ id = 'personallocker', owner = 'license:xxxxxx'}`
- item: `string`
- The name of the item to remove from the target.
- count: `number`
- The number of items to remove.
- metadata?: `table` or `string`
- Only remove items with matching metadata properties.
- slot?: `number`
- A specific slot to remove the item from. If the slot is invalid, the first available slot will be used instead.
- cb?: function(success: `boolean`, response?: `string`)
Returns `success` as a boolean, stating whether the item was successfully removed.
**Example:**
```lua
-- Removes 1 water from the inventory
exports.ox_inventory:RemoveItem(source, 'water', 1)
```
-- Removes 2 water from the glovebox for the given plate.
local success = exports.ox_inventory:RemoveItem('gloveVGH283', 'water', 2)
```