From c013d3ff0cb98c4ddf1d7a20ff3cc3795f6b6786 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 17 Nov 2022 11:09:26 +0100 Subject: [PATCH] inventory client new properties style update --- .../Functions/Client/Inventory/Search.md | 17 ++++++++--------- .../Functions/Client/Utils/weaponWheel.md | 4 ++-- .../Functions/Client/displayMetadata.md | 17 ++++++----------- .../Functions/Client/openInventory.md | 15 ++++++++++++--- .../Functions/Client/setStashTarget.md | 11 ++++++++--- docs/ox_inventory/Functions/Client/useItem.md | 4 ++-- docs/ox_inventory/Functions/Client/useSlot.md | 4 ++-- 7 files changed, 40 insertions(+), 32 deletions(-) diff --git a/docs/ox_inventory/Functions/Client/Inventory/Search.md b/docs/ox_inventory/Functions/Client/Inventory/Search.md index 334768d8..abb94167 100644 --- a/docs/ox_inventory/Functions/Client/Inventory/Search.md +++ b/docs/ox_inventory/Functions/Client/Inventory/Search.md @@ -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 diff --git a/docs/ox_inventory/Functions/Client/Utils/weaponWheel.md b/docs/ox_inventory/Functions/Client/Utils/weaponWheel.md index 56752184..92c275ec 100644 --- a/docs/ox_inventory/Functions/Client/Utils/weaponWheel.md +++ b/docs/ox_inventory/Functions/Client/Utils/weaponWheel.md @@ -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) -``` \ No newline at end of file +``` +* state: `boolean` diff --git a/docs/ox_inventory/Functions/Client/displayMetadata.md b/docs/ox_inventory/Functions/Client/displayMetadata.md index a6fe2ac7..a910cd76 100644 --- a/docs/ox_inventory/Functions/Client/displayMetadata.md +++ b/docs/ox_inventory/Functions/Client/displayMetadata.md @@ -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' }) -``` \ No newline at end of file +``` diff --git a/docs/ox_inventory/Functions/Client/openInventory.md b/docs/ox_inventory/Functions/Client/openInventory.md index 6bb8eb2f..259c02a7 100644 --- a/docs/ox_inventory/Functions/Client/openInventory.md +++ b/docs/ox_inventory/Functions/Client/openInventory.md @@ -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` diff --git a/docs/ox_inventory/Functions/Client/setStashTarget.md b/docs/ox_inventory/Functions/Client/setStashTarget.md index 05e97791..b6928045 100644 --- a/docs/ox_inventory/Functions/Client/setStashTarget.md +++ b/docs/ox_inventory/Functions/Client/setStashTarget.md @@ -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') -``` \ No newline at end of file +``` diff --git a/docs/ox_inventory/Functions/Client/useItem.md b/docs/ox_inventory/Functions/Client/useItem.md index 81b37a45..f26fc924 100644 --- a/docs/ox_inventory/Functions/Client/useItem.md +++ b/docs/ox_inventory/Functions/Client/useItem.md @@ -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) diff --git a/docs/ox_inventory/Functions/Client/useSlot.md b/docs/ox_inventory/Functions/Client/useSlot.md index 19818b42..3482b20f 100644 --- a/docs/ox_inventory/Functions/Client/useSlot.md +++ b/docs/ox_inventory/Functions/Client/useSlot.md @@ -1,6 +1,6 @@ Uses the item in the given inventory slot. ```lua --- slot: number exports.ox_inventory:useSlot(slot) -``` \ No newline at end of file +``` +* slot: `number`