Installation (ESX)
Apply the required es_extended modifications for Grid Inventory.
ESX modification
Modify the es_extended resource by following the sections below.
Modifications
Configuration
config.lua
Set the default ESX inventory option to false.
config.lua
Config.EnableDefaultInventory = false
Configuration
server/functions.lua
Use the code matching your old or new ESX version.
- Old
- New
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/functions.lua
function ESX.GetItemLabel(item)
local item = exports["avp_grid_inventory"]:GetRegisteredItem(item)
if item then
return item.formatName
end
end
Configuration
server/main.lua
Delete the following section from 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
Item migration
Convert old ESX items
Convert your old items to the new inventory format. The command will not erase the old items.
Convert_ESXBefore running
Register your old items with RegisterItem in avp_grid_inventory. Unregistered items will not be added.
AccountMoney as items
Add your accounts here which you want to use them as items.
Configuration
Account money as items
Add the accounts that you want to use as inventory items.
source/cfx_based/server/frameworks/esx.lua
local accountsAsItems = {
["money"] = true
}