inventory client new properties style update

This commit is contained in:
Luke committed 2022-11-17 11:09:26 +01:00
1 parent 5d2f3e22ff
commit c013d3ff0c
7 files changed
+40 -32

No files matched your search

@@ -4,17 +4,16 @@ import TabItem from '@theme/TabItem';
Searches the inventory for an item, or list of items, with the result varying based on the first argument.
```lua
-- search: string
-- item: table or string
-- metadata: table or string (optional)
exports.ox_inventory:Search(search, item, metadata)
```
If the `search` argument is defined as `'slots'` the return will be a table
of slots where the item was found at.
Otherwise if the `search` argument is defined as `'count'` the return value
will be the amount of the specified item in player's inventory.
* search: `'slots'` or `'count'`
* `'slots'` returns a table of slots where the item was found at.
* `'count'` returns the count of the specified item in player's inventory. If searching for multiple items
returns key-value pairs of itemName = count.
* item: `table` or `string`
* Can be a single item name or array of item names.
* metadata?: `table` or `string`
* If metadata is provided as a string it will search the item's `metadata.type` property.
### Count
@@ -3,6 +3,6 @@ Enables the weapon wheel, but disables the use of inventory items.
Mostly used for weaponised vehicles, though could be called for "minigames"
```lua
-- state: boolean
local exports.ox_inventory:weaponWheel(state)
```
```
* state: `boolean`
@@ -1,18 +1,13 @@
Sets a metadata property to display in the tooltip.
```lua
-- metadata: table or string
-- value: string (optional)
exports.ox_inventory:displayMetadata(metadata, value)
```
`metadata` can either be table or string, if it's a string it's the metadata property
that you want to display, `value` is **not** optional then.
`value` represents the _label_ for the property you want to display.
Otherwise `metadata` can be a table of key value pairs, key being the metadata property
and value being the label for that metadata.
* metadata: `table` or `string`
* If metadata is a string then it's the metadata property you want to display, value is **not** optional then.
* Can be a table of key-value pairs, key being the metadata property and value being the label for that property.
* value?: `string`
* Label for the string metadata property to be displayed.
**Example:**
```lua
@@ -24,4 +19,4 @@ exports.ox_inventory:displayMetadata({
mustard = 'Mustard',
ketchup = 'Ketchup'
})
```
```
@@ -1,13 +1,22 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Opens an inventory using on the passed data.
Opens an inventory using the passed data.
```lua
-- invType: string
-- data: number | string | table
exports.ox_inventory:openInventory(invType, data)
```
* invType: `string`
* `'player'`
* `'shop'`
* `'stash'`
* `'crafting'`
* `'container'`
* `'drop'`
* `'glovebox'`
* `'trunk'`
* `'dumpster'`
* data: `number` or `string` or `table`
<Tabs>
<TabItem value="1" label="Player">
@@ -1,9 +1,14 @@
Forces the secondary-inventory key to open the passed inventory. Can be useful to enable inventory access while standing inside a marker.
```lua
-- id: string or number
-- owner: string or number (optional)
exports.ox_inventory:setStashTarget(id, owner)
```
* id: `string` or `number`
* Stash id.
* owner?: `string` or `number`
**Example:**
```lua
exports.ox_inventory:setStashTarget('motel5', 'bobsmith')
```
```
@@ -2,10 +2,10 @@ Uses the passed item, then triggers the callback function.
Should be calling during item callbacks to utilise the builtin methods (server checks, progress bar, etc.).
```lua
-- data: table
-- cb: function (optional)
exports.ox_inventory:useItem(data, cb)
```
* data: `table`
* cb?: `function`
```lua
exports('bandage', function(data, slot)
@@ -1,6 +1,6 @@
Uses the item in the given inventory slot.
```lua
-- slot: number
exports.ox_inventory:useSlot(slot)
```
```
* slot: `number`