Skip to main content

Install (ESX)

Installing & dependencies.

warning

Modify the es_extended resource, follow the steps ahead.

Modifications

config.lua

config.lua
Config.EnableDefaultInventory = false

server/functions.lua

server/functions.lua
function ESX.GetItemLabel(item)
if Config.OxInventory then
item = exports.ox_inventory:Items(item)
if item then
return item.label
end
end

if ESX.Items[item] then
return ESX.Items[item].label
else
print('[^3WARNING^7] Attemting to get invalid Item -> ^5' .. item .. "^7")
end
end

server/main.lua

warning

Delete this section from the code.

Delete this from the server/main.lua
  -- Inventory
if not Config.OxInventory then
if result.inventory and result.inventory ~= '' then
local inventory = json.decode(result.inventory)

for name, count in pairs(inventory) do
local item = ESX.Items[name]

if item then
foundItems[name] = count
else
print(('[^3WARNING^7] Ignoring invalid item ^5"%s"^7 for ^5"%s^7"'):format(name, identifier))
end
end
end

for name, item in pairs(ESX.Items) do
local count = foundItems[name] or 0
if count > 0 then
userData.weight = userData.weight + (item.weight * count)
end

table.insert(userData.inventory,
{name = name, count = count, label = item.label, weight = item.weight, usable = Core.UsableItemsCallbacks[name] ~= nil, rare = item.rare,
canRemove = item.canRemove})
end

table.sort(userData.inventory, function(a, b)
return a.label < b.label
end)
else
if result.inventory and result.inventory ~= '' then
userData.inventory = json.decode(result.inventory)
else
userData.inventory = {}
end
end

Converting old items

You can use the server command: Convert_ESX, it should convert the old items to the new inventory. This function will not erase the old items, so do not be afraid.

Do not forget to register the old items before running this command. If the item is not registered via the RegisterItem function in the avp_grid_inventory then the item will not be added.

AccountMoney as items

Add your accounts here which you want to use them as items.

source/cfx_based/server/frameworks/esx.lua
local accountsAsItems = {
["money"] = true
}