Origen Network Store
  • 👋Welcome to Origen Network Store
  • 🆘¿You need help?
  • ❓FAQS
  • 👮Origen Police
    • ⚠️Dependencies
    • 🔧Installation
      • SQL
      • Pma-Voice
    • 📙Guide of Use
      • 💻Police CAD
        • Dispatch
        • Citizen Search
        • Reports
        • Vehicles
        • Criminal Code
        • Search and Capture
        • Debtors
        • Federal Management
        • Agent Management
        • Security Cameras
        • Radio
        • Time Control
        • Operations
      • 📄Interaction Menu
      • 📹Vehicle Radar
      • 🚔Sirens System
      • 🔦Evidence System
      • 🎛️Mini Dispatch
      • 🚁Helicopter Camera
      • 🪪Badges
      • ⛓️Federal System
      • 🔫Holster
      • 🐕K9 Dog
    • ❓Frequent Questions
    • ⚙️Configuration
      • Framework
      • Armoury
      • Commands
      • Confiscate
      • Evidences
      • Federal
      • Holster
      • K9
      • Licenses
      • Markers
      • Names
      • Outfits
      • Permissions
      • Props
      • Radio
      • Vehicles
    • #️⃣Exports
      • Client Exports
      • Server Exports
  • 📻Origen Radio
    • ⚠️Dependencies
    • 🔧Installation
      • SQL
      • Pma-Voice
    • ⚙️Configuration
  • 🛠️Origen Admin
    • ⚠️Dependencies
    • 🔧Installation
      • SQL
  • 🏎️Origen Races
    • ⚠️Dependencies
    • 🔧Installation
      • SQL
    • #️⃣Exports
      • Client Exports
  • 🔫Origen Ilegal
    • ⚠️Dependencies
    • 🔧Installation
      • SQL
      • qb-inventory
    • 💬Commands
    • ♻️Exports
  • 🏚️Origen Housing
    • ⚠️Dependencies
    • 🔧Installation
      • SQL
    • ⚙️API
      • Exports
      • Hooks
      • Events
      • Scripts Support
        • 📱LB-Phone
  • 🚙Origen Parking
    • ⚠️Dependencies
    • 🔧Installation
      • QBCore SQL
      • ESX SQL
    • ⚙️Configuration
    • ♻️Exports
  • 💼origen_inventory
    • ⚠️Dependencies
    • 🔧Installation
      • SQL
    • ⛏️Scripts Support
      • 📱LB Phone
        • 2️From v2.1.14
      • 🏨QB Apartments
      • 🔫QB-Weapons
      • 🔨Jobs creator (Jaksam)
    • ♻️Exports
      • 🛥️Client Exports
      • ⚓Server
        • Hooks
    • How to
  • 🕵️‍♂️origen_hostage
    • 🔧Installation
  • 👷‍♂️Origen Masterjob
    • 🔧Installation
      • SQL
      • qb-inventory
      • qs-inventory
      • ox_inventory
    • ♻️Exports
  • QBCORE
    • 🍔origen_hud
      • ❔¿What is origen_hud?
      • 🔧Installations origen_hud
      • ❓FAQS origen_hud
    • 💬origen_notify
      • ❔¿What is origen_notify?
      • 🔧Installations origen_notify
      • ❓FAQS origen_notify
        • 🥬Snippets origen_notify
    • ⏸️origen_pausemenu
      • ❔¿What is origen_pausemenu?
      • 🔧Installations origen_pausemenu
      • ❓FAQS origen_pausemenu
      • 🔑EXPORTS origen_pausemenu
    • 🥷origen_blackmarket
      • ❔¿What is origen_blackmarket?
      • 🔧Installations origen_blackmarket
      • ❓FAQS origen_blackmarket
      • 🥬Snippets origen_blackmarket
    • 🧑‍🤝‍🧑origen_titlemenu
      • ❔¿What is origen_titlemenu?
      • 🔧Installations origen_titlemenu
      • ❓FAQS origen_titlemenu
      • 🥬Snippets origen_titles (soon)
    • 🚗origen_importheist
      • ❔¿What is origen_importheist?
      • 🔧Installations origen_importheist
      • ❓FAQS origen_importheist
      • 🥬Snippets origen_importheist (soon)
  • ESX
    • 🍔origen_hud
      • ❔¿What is origen_hud?
      • 🔧Installations origen_hud
      • ❓FAQS origen_hud
    • 💬origen_notify
      • ❔¿What is origen_notify?
      • 🔧Installations origen_notify
      • ❓FAQS origen_notify
      • 🥬Snippets origen_notify
    • ⏸️origen_pausemenu
      • ❔¿What is origen_pausemenu?
      • 🔧Installations origen_pausemenu
      • ❓FAQS origen_pausemenu
      • 🔑EXPORTS origen_pausemenu
    • 🧑‍🤝‍🧑origen_titlemenu
      • ❔¿What is origen_titlemenu?
      • 🔧Installations origen_titlemenu
      • ❓FAQS origen_titlemenu
      • 🥬Snippets origen_titles (soon)
    • 🚗origen_importheist
      • ❔¿What is origen_importheist?
      • 🔧Installations origen_importheist
      • ❓FAQS origen_importheist
      • 🥬Snippets origen_importheist (soon)
Powered by GitBook
On this page
  1. origen_inventory

Installation

Here we're going to guide you in the installation of origen_inventory.

PreviousDependenciesNextSQL

Last updated 3 months ago

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

From inventory versions 1.9.8 onwards, installation of QB-Core is automatic and requires NO code modifications.

Just install the SQL and the changes that appear in the video.

Only in certain cases it is possible that unrecognized function errors appear, for this we recommend following the steps below and implementing the code snippets.

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:

Add some code

Go to qb-core/server/functions.lua replace those functions:

function QBCore.Functions.CreateUseableItem(item, data)
    QBCore.UsableItems[item] = data
    exports['origen_inventory']:CreateUseableItem(item, data)
end
function QBCore.Functions.UseItem(source, item)
    if GetResourceState('origen_inventory') == 'missing' then return end
    exports['origen_inventory']:UseItem(source, item)
end
function QBCore.Functions.HasItem(source, items, amount)
    if GetResourceState('origen_inventory') == 'missing' then return end
    return exports['origen_inventory']:HasItem(source, items, amount)
end

Go to qb-core/server/player.lua, replace those functions:

function QBCore.Player.GetTotalWeight(items)
    if GetResourceState('origen_inventory') == 'missing' then return 0 end
    return exports['origen_inventory']:GetTotalWeightByItems(items)
end

Replace all the qb-inventory strings with origen_inventory in all the resources folder using visual studio code:

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:

exports("GetUseablesItems", function()
    return Core.UsableItemsCallbacks
end)

Add this file to the es_extended/server/classes/overrides folder

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

  1. Go to es_extended/shared/config/main.lua

  2. Find Config.CustomInventory

  3. Replace by

    Config.CustomInventory = 'origen_inventory'
  4. Done!

2. Install files

  1. Go to es_extended/server/bridge/inventory

  2. Copy the file below

  1. Go to es_extended/server/classes/overrides

  2. Copy the file below

💼
🔧
origen_inventory/origen_inventory.sql
origen_inventory/origen_inventory.sql
3KB
origeninventory.lua
2KB
origeninventory.lua
3KB
origeninventory.lua