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)
-- 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)
@@ -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.
@@ -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
-- 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 })
```
@@ -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')
```
+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
-- 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
-- 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>
</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.
@@ -98,94 +98,6 @@ The inventory will handle disabling the phone when the player has no item, and s
</a>
</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