Update examples and descriptions for ox_inventory

This commit is contained in:
Linden committed 2022-03-02 19:18:34 +11:00
1 parent 2a931c887a
commit ee76abb4db
10 files changed
+114 -125

No files matched your search

@@ -21,14 +21,8 @@ Options table values:
-- prop/propTwo: table (optional) -- prop/propTwo: table (optional)
-- model: hash or string -- model: hash or string
-- bone: number (optional - default is 60309) -- bone: number (optional - default is 60309)
-- pos: table (optional) -- pos: vector3 (optional)
-- x: number (default is 0) -- rot: vector3 (optional)
-- 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)
-- disable: table (optional) -- disable: table (optional)
-- move: boolean (optional) -- move: boolean (optional)
-- car: boolean (optional) -- car: boolean (optional)
@@ -48,10 +42,7 @@ exports.ox_inventory:Progress({
useWhileDead = false, useWhileDead = false,
canCancel = true, canCancel = true,
disable = { disable = {
move = false, car = true
car = true,
combat = true,
mouse = false
}, },
anim = { anim = {
dict = 'mp_player_intdrink', dict = 'mp_player_intdrink',
@@ -60,8 +51,8 @@ exports.ox_inventory:Progress({
}, },
prop = { prop = {
model = 'prop_ld_flow_bottle', model = 'prop_ld_flow_bottle',
pos = { x = 0.03, y = 0.03, y = 0.02}, pos = vector3(0.03, 0.03, 0.02),
rot = { x = 0.0, y = 0.0, y = -1.5}, rot = vector3(0.0, 0.0, -1.5),
bone = 58866 bone = 58866
}, },
}, function(cancel) }, function(cancel)
@@ -1,13 +1,13 @@
Searches the inventory for a specified item. Searches the inventory for a specified item.
```lua ```lua
-- search: string or number ('slots' | 1, 'count' | 2) -- search: string
-- item: table or string -- item: table or string
-- metadata: table or string (optional) -- metadata: table or string (optional)
expors.ox_inventory:Search(search, item, metadata) 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. 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. will be the amount of the specified item in player's inventory.
@@ -1,7 +0,0 @@
Returns a table of all registered items.
Works exactly the same as [Items](./ItemsExport.md)
```lua
exports.ox_inventory:ItemList()
```
@@ -1,7 +1,11 @@
Opens the passed inventory with passed data. Opens an inventory using on the passed data.
```lua ```lua
-- inv: string -- inv: string
-- data: table (optional) -- data: any
exports.ox_inventory:openInventory(inv, data) 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 })
``` ```
@@ -1,11 +1,9 @@
--- Forces the secondary-inventory key to open the passed inventory. Can be useful to enable inventory access while standing inside a marker.
title: setStashTarget
---
Sets the stash target to open.
```lua ```lua
-- id: string or number -- id: string or number
-- owner: string -- owner: string or number (optional)
exports.ox_inventory:setStashTaget(id, owner) exports.ox_inventory:setStashTarget(id, owner)
exports.ox_inventory:setStashTarget('motel5', 'bobsmith')
``` ```
+1 -1
View File
@@ -1,4 +1,4 @@
Uses the item passed as an argument. Uses the passed item, then triggers the callback function.
```lua ```lua
-- data: table -- data: table
+1 -1
View File
@@ -1,4 +1,4 @@
Uses the item on the slot passed in as an argument. Uses the item in the given inventory slot.
```lua ```lua
-- slot: number -- slot: number
+91
View File
@@ -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
```
+1 -89
View File
@@ -32,7 +32,7 @@ We provide full backwards compatibility with mysql-async and build for the curre
</a> </a>
</div> </div>
### 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. 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
</a> </a>
</div> </div>
## 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 ### Installation