mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 14:38:50 +00:00
5 files changed
+96
-15
No files matched your search
@@ -1,11 +1,7 @@
|
|||||||
Clears the specified inventory.
|
Clears the specified inventory. The `keep` argument is either a string or an array of strings containing the name(s) of the item(s) to keep in the inventory after clearing.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- inv: string or number
|
-- inv: string or number
|
||||||
-- keep: nil
|
-- keep:? string or string[]
|
||||||
exports.ox_inventory:ClearInventory(inv, keep)
|
exports.ox_inventory:ClearInventory(inv, keep)
|
||||||
```
|
```
|
||||||
:::caution
|
|
||||||
|
|
||||||
The `keep` argument is still unsupported and won't do anyting.
|
|
||||||
:::
|
|
||||||
@@ -133,7 +133,7 @@ You can compile it youself by following the [build guide](./Guides/inventory_ui)
|
|||||||
<TabItem value="fresh_esx" label="Fresh ESX" default>
|
<TabItem value="fresh_esx" label="Fresh ESX" default>
|
||||||
|
|
||||||
Use a compatible version of [ESX Legacy](https://github.com/esx-framework/esx-legacy) (1.6.0+)
|
Use a compatible version of [ESX Legacy](https://github.com/esx-framework/esx-legacy) (1.6.0+)
|
||||||
Execute the query inside [install.sql](https://github.com/overextended/ox_inventory/blob/main/setup/install.sql) and [vehicle.sql](https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql)
|
Execute the query inside [install.sql](https://github.com/overextended/ox_inventory/blob/main/setup/install.sql)
|
||||||
|
|
||||||
Start order should look like the following:
|
Start order should look like the following:
|
||||||
|
|
||||||
@@ -150,9 +150,8 @@ start ox_inventory
|
|||||||
|
|
||||||
Use a compatible version of [ESX Legacy](https://github.com/esx-framework/esx-legacy) (1.6.0+)
|
Use a compatible version of [ESX Legacy](https://github.com/esx-framework/esx-legacy) (1.6.0+)
|
||||||
Execute the query inside [install.sql](https://github.com/overextended/ox_inventory/blob/main/setup/install.sql)
|
Execute the query inside [install.sql](https://github.com/overextended/ox_inventory/blob/main/setup/install.sql)
|
||||||
and [vehicle.sql](https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql)
|
|
||||||
Open `fxmanifest.lua` and uncomment `server_script 'setup/convert.lua'`
|
Open `fxmanifest.lua` and uncomment `server_script 'setup/convert.lua'`
|
||||||
Start the server and execute the `convertinventory` command from the console
|
Start the server and execute the `convertinventory esx` command from the console
|
||||||
Remove the conversion file
|
Remove the conversion file
|
||||||
|
|
||||||
Start order should look like the following:
|
Start order should look like the following:
|
||||||
@@ -162,7 +161,42 @@ start oxmysql
|
|||||||
start es_extended
|
start es_extended
|
||||||
start ox_lib
|
start ox_lib
|
||||||
start ox_inventory
|
start ox_inventory
|
||||||
everything else
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="fresh_qb" label="Fresh QBCore" default>
|
||||||
|
|
||||||
|
Use the latest source code of [qb-core](https://github.com/qbcore-framework/qb-core)
|
||||||
|
To disable the weapon animation of qb-smallresources, use the latest source code of [qb-smallresources](https://github.com/qbcore-framework/qb-smallresources) (it will only disable if qb-inventory is **not** present inside the resources folder)
|
||||||
|
Execute the query inside [install.sql](https://github.com/overextended/ox_inventory/blob/main/setup/install.sql)
|
||||||
|
|
||||||
|
Start order should look like the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
start oxmysql
|
||||||
|
start qb-core
|
||||||
|
start ox_lib
|
||||||
|
start ox_inventory
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="convert_qb" label="Convert QBCore">
|
||||||
|
|
||||||
|
Use the latest source code of [qb-core](https://github.com/qbcore-framework/qb-core)
|
||||||
|
Execute the query inside [install.sql](https://github.com/overextended/ox_inventory/blob/main/setup/install.sql)
|
||||||
|
Open `fxmanifest.lua` and uncomment `server_script 'setup/convert.lua'`
|
||||||
|
Start the server and execute the `convertinventory qb` command from the console
|
||||||
|
Remove the conversion file
|
||||||
|
|
||||||
|
Start order should look like the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
start oxmysql
|
||||||
|
start qb-core
|
||||||
|
start ox_lib
|
||||||
|
start ox_inventory
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -170,9 +204,8 @@ everything else
|
|||||||
<TabItem value="convert_linden" label="Upgrade from Linden Inventory">
|
<TabItem value="convert_linden" label="Upgrade from Linden Inventory">
|
||||||
|
|
||||||
Execute the query inside [upgrade.sql](https://github.com/overextended/ox_inventory/blob/main/setup/upgrade.sql)
|
Execute the query inside [upgrade.sql](https://github.com/overextended/ox_inventory/blob/main/setup/upgrade.sql)
|
||||||
and [vehicle.sql](https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql)
|
|
||||||
Open `fxmanifest.lua` and uncomment `server_script 'setup/convert.lua'`
|
Open `fxmanifest.lua` and uncomment `server_script 'setup/convert.lua'`
|
||||||
Start the server and execute the `convertinventory` linden command from the console
|
Start the server and execute the `convertinventory linden` command from the console
|
||||||
Remove the conversion file
|
Remove the conversion file
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# QBCore
|
||||||
|
|
||||||
|
Ox Inventory provides a complete suite of tools to replace the built-in items and inventory system from QBCore, and is not intended to be used with resources designed around it.
|
||||||
|
|
||||||
|
- Stashes from resources such as qb-policejob, qb-ambulancejob, etc. should be removed, they are not compatible
|
||||||
|
- qb-inventory should be removed for optimal compatibility, if you didn't remove it, qb-core will not function properly and will show errors.
|
||||||
|
- qb-shops and qb-weapons automatically get stopped by Ox Inventory, so you don't have to worry about those, just don't start them manually after as they will conflict.
|
||||||
|
|
||||||
|
## Optional optimisation
|
||||||
|
|
||||||
|
All item related functions from Player, such as `xPlayer.Functions.GetItemByName`, have been modified for compatibility purposes; however they are considered deprecated.
|
||||||
|
|
||||||
|
The reasoning is fairly simple - there's now additional function references and overhead to consider. Fortunately, the new Inventory functions can be used directly and offer a great deal of improvements over the old ones.
|
||||||
|
|
||||||
|
You should read through the functions section for further information, but the following should give you a decent idea.
|
||||||
|
|
||||||
|
<Tabs>
|
||||||
|
<TabItem value="qb" label="QBCore">
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local acetone = Player.Functions.GetItemByName('acetone')
|
||||||
|
local antifreeze = Player.Functions.GetItemByName('antifreeze')
|
||||||
|
local sudo = Player.Functions.GetItemByName('sudo')
|
||||||
|
if acetone?.amount > 2 and antifreeze?.amount > 4 and sudo?.amount > 9 then
|
||||||
|
Player.Functions.RemoveItem("acetone", 3)
|
||||||
|
Player.Functions.RemoveItem("antifreeze", 5)
|
||||||
|
Player.Functions.RemoveItem("sudo", 10)
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="inventory" label="Inventory">
|
||||||
|
|
||||||
|
Add the following code somewhere in your resource to cache the exports metatable.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local ox_inventory = exports.ox_inventory
|
||||||
|
```
|
||||||
|
|
||||||
|
You will be able to reference any functions exposed through the export.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local items = ox_inventory:Search(source, 'count', {'acetone', 'antifreeze', 'sudo'})
|
||||||
|
if items and items.acetone > 2 and items.antifreeze > 4 and items.sudo > 9 then
|
||||||
|
ox_inventory:RemoveItem(source, 'acetone', 3)
|
||||||
|
ox_inventory:RemoveItem(source, 'antifreeze', 5)
|
||||||
|
ox_inventory:RemoveItem(source, 'sudo', 10)
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
@@ -147,7 +147,7 @@ A modified burger item, which gives you notifications on add and remove argument
|
|||||||
|
|
||||||
|
|
||||||
## Making the item usable
|
## Making the item usable
|
||||||
If you are using ESX you can continue using `ESX.RegisterUsableItem` if desired.
|
If you are using ESX you can continue using `ESX.RegisterUsableItem` (for QBCore that is `QBCore.Functions.CreateUseableItem`) if desired.
|
||||||
Using the built-in system is more secure and provides simple progressbar support.
|
Using the built-in system is more secure and provides simple progressbar support.
|
||||||
|
|
||||||
An item will be usable when client variables are added to [data/items.lua](https://github.com/overextended/ox_inventory/blob/main/data/items.lua), or has a registered item callback. Item callbacks can be added by defining an export (recommended), or by adding it to [items/client.lua](https://github.com/overextended/ox_inventory/blob/main/modules/items/client.lua#L33).
|
An item will be usable when client variables are added to [data/items.lua](https://github.com/overextended/ox_inventory/blob/main/data/items.lua), or has a registered item callback. Item callbacks can be added by defining an export (recommended), or by adding it to [items/client.lua](https://github.com/overextended/ox_inventory/blob/main/modules/items/client.lua#L33).
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Convars **must** be set before starting ox_inventory.
|
|||||||
The values below are _defaults_ and should not be explicitly set unless changing the value.
|
The values below are _defaults_ and should not be explicitly set unless changing the value.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
# Activate specific event handlers and functions (supported: ox, esx)
|
# Activate specific event handlers and functions (supported: ox, esx, qb)
|
||||||
setr inventory:framework "esx"
|
setr inventory:framework "esx"
|
||||||
|
|
||||||
# Load specific language file from data/locales
|
# Load specific language file from data/locales
|
||||||
@@ -23,7 +23,7 @@ setr inventory:locale "en"
|
|||||||
# Number of slots for player inventories
|
# Number of slots for player inventories
|
||||||
setr inventory:slots 50
|
setr inventory:slots 50
|
||||||
|
|
||||||
# Maximum carry capacity for players, in kilograms
|
# Maximum carry capacity for players, in grams (will be automatically converted to kilograms in-game)
|
||||||
setr inventory:weight 30000
|
setr inventory:weight 30000
|
||||||
|
|
||||||
# Weapons will reload after reaching 0 ammo
|
# Weapons will reload after reaching 0 ammo
|
||||||
|
|||||||
Reference in new issue
Block a user