ESX

  • You will need a compatible version of ESX Legacy (opens in a new tab) (1.6.0 or higher).
  • You can convert player inventories with convertinventory esx.
  • All items in the database will be migrated to the internal item data.
    • Always restart the resource when items are migrated!

Compatibility

Ox Inventory is a complete replacement for existing item, inventory, and weapon systems; it is inherently incompatible with ESX and any resources that rely on default behaviour.

  • Loadouts do not exist and weapons are treated as items.
  • Standard shops and stashes (i.e. esx_shops, esx_weaponshop, and esx_policejob).
  • Resources that alter the default esx inventory or provide a ui (i.e. esx_trunkinventory, esx_inventoryhud).

Installation

start oxmysql
start ox_lib
start es_extended
start qtarget
start ox_inventory

Convert ESX inventory data

  • Start the server and type convertinventory esx into the server console.
  • Optionally, type convertinventory esxproperty into the server console.
  • Restart the server once conversion is complete.

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