First we want you to know that our script only supports the following versions of the two most used frameworks, in older versions it may be usable but we do not provide support since the development focuses on the following versions:
VERY IMPORTANT for any framework
For a safe startup, please do not put your framework and inventory folders in shared folders (they are in brackets)
If you do:
ensure qb-core
ensure origen_inventory
And, we assume that origin_inventory is inside [origen] and then do:
ensure [origen]
This will cause origin_inventory to restart again and make it error out, same for core.
REMOVE THESE RESOURCES FROM BRACKETS FOLDERS AND SET ON ROOT RESOURCES FOLDER.
IMPORTANT
Installation of QB-Core is automatic and requires NO code modifications.
server.cfg
ensure oxmysql
ensure qb-core
ensure origen_inventory
...(make sure starts other scripts that use inventory functions after the origen_inventory)
Now you have to insert the SQL files into your database:
Qb-Inventory Compatibility
Go to origen_inventory/fxmanifest.lua and uncomment:
-- Before:
-- provide 'qb-inventory'
-- After:
provide 'qb-inventory'
Since this and the latest versions of the inventory, installing Origen Inventory has been easier than ever.
We only need to place two files without making any modifications to the framework.
1. ESX Config
Go to es_extended/shared/config/main.lua
Find Config.CustomInventory
Replace by
Config.CustomInventory = 'origen_inventory'
Done!
2. Install files
Go to es_extended/server/bridge/inventory
Copy the file below
Go to es_extended/server/classes/overrides
Copy the file below
server.cfg
ensure oxmysql
ensure es_extended
ensure origen_inventory
...(make sure to start other scripts that use inventory functions after the origen_inventory)
Now you have to insert the SQL files into your database:
Add some code
Go to es_extended/client/common.lua and add this code:
if GetResourceState('origen_inventory') ~= 'missing' then
Config.OrigenInventory = true
end
Go to es_extended/client/functions.lua and replace the ESX.GetPlayerData function:
function ESX.GetPlayerData()
if Config.OrigenInventory then
TriggerEvent('__cfx_export_origen_inventory_getPlayerInventory', function(ref)
if ref then
ESX.PlayerData.inventory = ref()
end
end)
end
return ESX.PlayerData
end
Go to es_extended/server/common.lua and add this code above the StartDBSync function:
if GetResourceState('origen_inventory') ~= 'missing' then
Config.OrigenInventory = true
Config.PlayerFunctionOverride = 'OrigenInventory'
end
Go to es_extended/server/common.lua and add this code below the Core.DatabaseConnected = true:
if Config.OrigenInventory then
ESX.Items = exports['origen_inventory']:GetItemList()
end
Go to es_extended/server/functions.lua and add this code at the end of the file:
AddEventHandler('onResourceStop', function(resourceName)
if (resourceName == "origen_inventory") then
Core.SavePlayers()
end
end)
Go to es_extended/server/functions.lua and replace the ESX.RegisterUsableItem function:
function ESX.RegisterUsableItem(item, cb)
Core.UsableItemsCallbacks[item] = cb
if Config.OrigenInventory then
exports['origen_inventory']:CreateUseableItem(item, cb)
end
end
Go to es_extended/server/functions.lua and replace the ESX.UseItem function:
function ESX.UseItem(source, item, ...)
local src, itm = source, item
if type(src) == 'string' then item = src source = itm end
if ESX.Items[item] then
local itemCallback = Core.UsableItemsCallbacks[item]
if Config.OrigenInventory then
return exports['origen_inventory']:UseItem(item, source, ...)
end
if itemCallback then
local success, result = pcall(itemCallback, source, item, ...)
if not success then
return result and print(result) or print(('[^3WARNING^7] An error occured when using item ^5"%s"^7! This was not caused by ESX.'):format(item))
end
end
else
print(('[^3WARNING^7] Item ^5"%s"^7 was used but does not exist!'):format(item))
end
end
Go to es_extended/server/functions.lua and replace the ESX.GetItemLabel function:
function ESX.GetItemLabel(item)
if Config.OrigenInventory then
return exports['origen_inventory']:GetItemLabel(item)
end
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%s^7'):format(item))
end
end
Go to es_extended/server/functions.lua and add this code at the bottom of the file: