From ee76abb4db34a3cd5570f1c8b3e932459b186659 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Wed, 2 Mar 2022 19:18:34 +1100 Subject: [PATCH] Update examples and descriptions for ox_inventory --- .../External/Client/Interface/Progress.md | 19 +--- .../External/Client/Inventory/Search.md | 6 +- .../External/Client/Items/ItemList.md | 7 -- .../Client/Items/{ItemsExport.md => index.md} | 0 .../External/Client/openInventory.md | 10 +- .../External/Client/setStashTarget.md | 12 +-- .../Functions/External/Client/useItem.md | 2 +- .../Functions/External/Client/useSlot.md | 2 +- docs/ox_inventory/config.md | 91 +++++++++++++++++++ docs/ox_inventory/installation.mdx | 90 +----------------- 10 files changed, 114 insertions(+), 125 deletions(-) delete mode 100644 docs/ox_inventory/Functions/External/Client/Items/ItemList.md rename docs/ox_inventory/Functions/External/Client/Items/{ItemsExport.md => index.md} (100%) create mode 100644 docs/ox_inventory/config.md diff --git a/docs/ox_inventory/Functions/External/Client/Interface/Progress.md b/docs/ox_inventory/Functions/External/Client/Interface/Progress.md index afc4049a..0d605950 100644 --- a/docs/ox_inventory/Functions/External/Client/Interface/Progress.md +++ b/docs/ox_inventory/Functions/External/Client/Interface/Progress.md @@ -21,14 +21,8 @@ Options table values: -- prop/propTwo: table (optional) -- model: hash or string -- bone: number (optional - default is 60309) - -- pos: table (optional) - -- x: number (default is 0) - -- y: number (default is 0) - -- z: numebr (default is 0) - -- rot: table (optional) - -- x: number (default is 0) - -- y: number (default is 0) - -- z: number (default is 0) + -- pos: vector3 (optional) + -- rot: vector3 (optional) -- disable: table (optional) -- move: boolean (optional) -- car: boolean (optional) @@ -48,10 +42,7 @@ exports.ox_inventory:Progress({ useWhileDead = false, canCancel = true, disable = { - move = false, - car = true, - combat = true, - mouse = false + car = true }, anim = { dict = 'mp_player_intdrink', @@ -60,8 +51,8 @@ exports.ox_inventory:Progress({ }, prop = { model = 'prop_ld_flow_bottle', - pos = { x = 0.03, y = 0.03, y = 0.02}, - rot = { x = 0.0, y = 0.0, y = -1.5}, + pos = vector3(0.03, 0.03, 0.02), + rot = vector3(0.0, 0.0, -1.5), bone = 58866 }, }, function(cancel) diff --git a/docs/ox_inventory/Functions/External/Client/Inventory/Search.md b/docs/ox_inventory/Functions/External/Client/Inventory/Search.md index 4a0ddb54..5185130c 100644 --- a/docs/ox_inventory/Functions/External/Client/Inventory/Search.md +++ b/docs/ox_inventory/Functions/External/Client/Inventory/Search.md @@ -1,13 +1,13 @@ Searches the inventory for a specified item. ```lua --- search: string or number ('slots' | 1, 'count' | 2) +-- search: string -- item: table or string -- metadata: table or string (optional) expors.ox_inventory:Search(search, item, metadata) ``` -If the `search` argument is defined as `'slots'` or `1` the return will be a table +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'` or `2` the return value +Otherwise if the `search` argument is defined as `'count'` the return value will be the amount of the specified item in player's inventory. \ No newline at end of file diff --git a/docs/ox_inventory/Functions/External/Client/Items/ItemList.md b/docs/ox_inventory/Functions/External/Client/Items/ItemList.md deleted file mode 100644 index 0ea1bec4..00000000 --- a/docs/ox_inventory/Functions/External/Client/Items/ItemList.md +++ /dev/null @@ -1,7 +0,0 @@ -Returns a table of all registered items. - -Works exactly the same as [Items](./ItemsExport.md) - -```lua -exports.ox_inventory:ItemList() -``` \ No newline at end of file diff --git a/docs/ox_inventory/Functions/External/Client/Items/ItemsExport.md b/docs/ox_inventory/Functions/External/Client/Items/index.md similarity index 100% rename from docs/ox_inventory/Functions/External/Client/Items/ItemsExport.md rename to docs/ox_inventory/Functions/External/Client/Items/index.md diff --git a/docs/ox_inventory/Functions/External/Client/openInventory.md b/docs/ox_inventory/Functions/External/Client/openInventory.md index 73293cdd..006df0c2 100644 --- a/docs/ox_inventory/Functions/External/Client/openInventory.md +++ b/docs/ox_inventory/Functions/External/Client/openInventory.md @@ -1,7 +1,11 @@ -Opens the passed inventory with passed data. +Opens an inventory using on the passed data. ```lua -- inv: string --- data: table (optional) -exports.ox_inventory:openInventory(inv, data) +-- data: any +exports.ox_inventory:openInventory(invType, data) + +exports.ox_inventory:openInventory('player', 1) +exports.ox_inventory:openInventory('stash', 1) +exports.ox_inventory:openInventory('shop', { type = 'PoliceArmoury', id = 1 }) ``` \ No newline at end of file diff --git a/docs/ox_inventory/Functions/External/Client/setStashTarget.md b/docs/ox_inventory/Functions/External/Client/setStashTarget.md index b1c9db26..05e97791 100644 --- a/docs/ox_inventory/Functions/External/Client/setStashTarget.md +++ b/docs/ox_inventory/Functions/External/Client/setStashTarget.md @@ -1,11 +1,9 @@ ---- -title: setStashTarget ---- - -Sets the stash target to open. +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 -exports.ox_inventory:setStashTaget(id, owner) +-- owner: string or number (optional) +exports.ox_inventory:setStashTarget(id, owner) + +exports.ox_inventory:setStashTarget('motel5', 'bobsmith') ``` \ No newline at end of file diff --git a/docs/ox_inventory/Functions/External/Client/useItem.md b/docs/ox_inventory/Functions/External/Client/useItem.md index eadde385..695acc4e 100644 --- a/docs/ox_inventory/Functions/External/Client/useItem.md +++ b/docs/ox_inventory/Functions/External/Client/useItem.md @@ -1,4 +1,4 @@ -Uses the item passed as an argument. +Uses the passed item, then triggers the callback function. ```lua -- data: table diff --git a/docs/ox_inventory/Functions/External/Client/useSlot.md b/docs/ox_inventory/Functions/External/Client/useSlot.md index 7ea93d6d..19818b42 100644 --- a/docs/ox_inventory/Functions/External/Client/useSlot.md +++ b/docs/ox_inventory/Functions/External/Client/useSlot.md @@ -1,4 +1,4 @@ -Uses the item on the slot passed in as an argument. +Uses the item in the given inventory slot. ```lua -- slot: number diff --git a/docs/ox_inventory/config.md b/docs/ox_inventory/config.md new file mode 100644 index 00000000..aae56a1a --- /dev/null +++ b/docs/ox_inventory/config.md @@ -0,0 +1,91 @@ +# Configuration + +You can add these settings directly to your 'server.cfg', or add them to a separate file and call it with `exec`. +Convars must be set before starting ox_inventory. + +The values below are _defaults_ and should not be explicitly set unless changing the value. + +```yml +# Activate specific event handlers and functions (supported: ox, esx) +setr inventory:framework "esx" + +# Load specific language file from data/locales +setr inventory:locale "en" + +# Number of slots for player inventories +setr inventory:slots 50 + +# Maximum carry capacity for players, in kilograms +setr inventory:weight 30000 + +# Weapons will reload after reaching 0 ammo +setr inventory:autoreload false + +# Weapons must be aimed before shooting +setr aimedfiring false + +# Blur the screen while accessing the inventory +setr inventory:screenblur true + +# Trim whitespace from vehicle plates when checking owned vehicles +setr inventory:trimplate true + +# Integrated support for qtarget stashes, shops, etc +setr inventory:qtarget false + +# Default hotkeys to access primary and secondary inventories, and hotbar +setr inventory:keys ["F2", "K", "TAB"] + +# Enable control action when inventory is open +setr inventory:enablekeys [249] + +# Jobs with access to police armoury, evidence lockers, etc +setr inventory:police ["police", "sheriff"] + +# Item prices fluctuate in shops +set inventory:randomprices true + +# Compare current version to latest release on GitHub +set inventory:versioncheck true + +# Loot will randomly generate inside unowned vehicles and dumpsters +set inventory:randomloot true + +# Minimum job grade to remove items from evidence lockers +set inventory:evidencegrade 2 + +# Stashes will be wiped after remaining unchanged for the given time +set inventory:clearstashes "6 MONTH" + +# Set the contents of randomly generated inventories +# [item name, minimum, maxiumum, loot chance] +set inventory:vehicleloot [ + ["cola", 1, 1], + ["water", 1, 1], + ["garbage", 1, 2, 50], + ["panties", 1, 1, 5], + ["money", 1, 50], + ["money", 200, 400, 5], + ["bandage", 1, 1] +] + +set inventory:dumpsterloot [ + ["mustard", 1, 1], + ["garbage", 1, 3], + ["money", 1, 10], + ["burger", 1, 1] +] + +# Set datadog API key for inventory logging (https://app.datadoghq.com/organization-settings/api-keys) +set datadog:key "" + +# Set server intake (https://docs.datadoghq.com/api/latest/logs/#send-logs) +set datadog:site "datadoghq.com" + +# Set server hostname +set datadog:hostname "FXServer" + +add_principal group.admin ox_inventory +add_ace resource.ox_inventory command.add_principal allow +add_ace resource.ox_inventory command.remove_principal allow +``` \ No newline at end of file diff --git a/docs/ox_inventory/installation.mdx b/docs/ox_inventory/installation.mdx index cb14e884..aebd659b 100644 --- a/docs/ox_inventory/installation.mdx +++ b/docs/ox_inventory/installation.mdx @@ -32,7 +32,7 @@ We provide full backwards compatibility with mysql-async and build for the curre -### Lua Library +### Ox Lib A resource designed to provide reusable functions that can be loaded into any resource with simple variable declarations rather than through fxmanifest. @@ -98,94 +98,6 @@ The inventory will handle disabling the phone when the player has no item, and s -## Configuration - -You can add these settings directly to your 'server.cfg', create a new (or multiple) file to load with 'exec' -or add them to the `config.cfg` file in the inventory root and execute that. - -You do not need to specify convars when you are not changing the values, as they will default. - -``` -# Activate specific event handlers and functions (supported: ox, esx) -setr inventory:framework "esx" - -# Load specific language file from data/locales -setr inventory:locale "en" - -# Number of slots for player inventories -setr inventory:slots 50 - -# Maximum carry capacity for players, in kilograms -setr inventory:weight 30000 - -# Weapons will reload after reaching 0 ammo -setr inventory:autoreload false - -# Blur the screen while accessing the inventory -setr inventory:screenblur true - -# Trim whitespace from vehicle plates when checking owned vehicles -setr inventory:trimplate true - -# Integrated support for qtarget stashes, shops, etc -setr inventory:qtarget false - -# Default hotkeys to access primary and secondary inventories, and hotbar -setr inventory:keys ["F2", "K", "TAB"] - -# Enable control action when inventory is open -setr inventory:enablekeys [249] - -# Jobs with access to police armoury, evidence lockers, etc -setr inventory:police ["police", "sheriff"] - -# Item prices fluctuate in shops -set inventory:randomprices true - -# Compare current version to latest release on GitHub -set inventory:versioncheck true - -# Loot will randomly generate inside unowned vehicles and dumpsters -set inventory:randomloot true - -# Minimum job grade to remove items from evidence lockers -set inventory:evidencegrade 2 - -# Stashes will be wiped after remaining unchanged for the given time -set inventory:clearstashes "6 MONTH" - -# Set the contents of randomly generated inventories -# [item name, minimum, maxiumum, loot chance] -set inventory:vehicleloot [ - ["cola", 1, 1], - ["water", 1, 1], - ["garbage", 1, 2, 50], - ["panties", 1, 1, 5], - ["money", 1, 50], - ["money", 200, 400, 5], - ["bandage", 1, 1] -] - -set inventory:dumpsterloot [ - ["mustard", 1, 1], - ["garbage", 1, 3], - ["money", 1, 10], - ["burger", 1, 1] -] - -# Set datadog API key for inventory logging (https://app.datadoghq.com/organization-settings/api-keys) -set datadog:key "" - -# Set server intake (https://docs.datadoghq.com/api/latest/logs/#send-logs) -set datadog:site "datadoghq.com" - -# Set server hostname -set datadog:hostname "FXServer" - -add_principal group.admin ox_inventory -add_ace resource.ox_inventory command.add_principal allow -add_ace resource.ox_inventory command.remove_principal allow -``` ### Installation