Skip to main content

Getting Started

caution

This resource is being designed with the intention of providing advanced functionality while remaining easy to use, however it is not recommended for beginners. You must possess a basic understanding of coding and the ability to read; otherwise you should not install this resource.

Dependecies​

OxMySQL​

We utilise our own resource to communicate with MySQL databases via the node-mysql2 package. The backend is actively maintained and updated unlike the package used by mysql-async, providing improved performance, security, and features. We provide full backwards compatibility with mysql-async and build for the current Cfx architecture.

Ox Lib​

A resource designed to provide reusable functions that can be loaded into any resource with simple variable declarations rather than through fxmanifest.

Currently used for:

  • SetInterval
  • Server Callbacks
  • Table utilities (contains, matches)
  • Requesting models, animations, etc.
  • Disabling control actions

Production Build​

The interface is written in TypeScript using the React library, so the code included in the repository will not work. You either need to build the package yourself (more information in guides section), or download a release (ox_inventory.zip).

Optional resources​

The resources listed under here aren't necessary for the inventory to work but still have full support.

qtarget​

A high performance targeting solution based on bt-target, and the basis for qb-target. It is being updated alongside Ox Inventory to improve support as well as add compatibility when using QBCore or migrating from bt-target. All stashes and shops will utilise PolyZone's instead of markers to interact with them.

caution

If you wish to use it first you must ensure that qtarget is enabled in the resource convars. You will need to enable compatibility manually by adjusting your config - more information provided below.

You must start qtarget before the inventory and after your framework.

NPWD​

A standalone and feature-rich phone created by Project Error.

The inventory will handle disabling the phone when the player has no item, and supports toggling the phone through item use.

Installation​

Use a compatible version of ESX Legacy (1.6.0+)
Execute the query inside install.sql and vehicle.sql

Start order should look like the following:

start oxmysql
start es_extended
start ox_lib
start ox_inventory
...
caution

You should restart your server after the first startup to ensure everything has been correctly setup

Upgrading ESX​

Ox Inventory provides a complete suite of tools to replace the built-in items and inventory system from ESX, and is not intended to be used with resources designed around it.

  • ESX loadouts do not exist - resources that use them need to remove references or be modified to look for the weapon as an item
  • Stashes from resources such as esx_policejob, esx_ambulancejob, etc. should be removed
  • Shops from esx_shops or the armoury from esx_policejob should be removed
  • Resources like esx_inventoryhud, esx_trunkinventory, esx_addoninventory, etc. should be removed

Optional optimisation​

All item related functions from xPlayer, such as xPlayer.getInventoryItem, 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.

if xPlayer.getInventoryItem('acetone').count > 2 and xPlayer.getInventoryItem('antifreeze').count > 4 and xPlayer.getInventoryItem('sudo').count > 9 then
xPlayer.removeInventoryItem("acetone", 3)
xPlayer.removeInventoryItem("antifreeze", 5)
xPlayer.removeInventoryItem("sudo", 10)
end