Inventory

Instruction and guide on how to setup your inventory for T1GER resources

Introduction

T1GER Resources supports compatibility with popular custom inventories. We plan on adding "out-the-box" compatibility with more inventories as they are being proposed to us.

You can also use the 'custom' option and integrate your own exports/function for whatever custom inventory you may have.

Config.Inventory

Config.Inventory = 'ox-inventory' -- Set the inventory system

Specifies the custom inventory system in use. Update this based on your selected inventory system.

  • Type: string

  • Options:

    • 'ox-inventory' - Ox Inventory

    • 'qb-inventory' - QB Inventory

    • 'mf-inventory' - ModFreakz Inventory (paid)

    • 'qs-inventory' - Quasar Inventory (paid)

    • 'core-inventory' - Core Inventory (paid)

    • 'codem-inventory' - CodeM Inventory (paid)

    • 'custom' - If none of these are being used or if you want to integrate your own!

Setup

All you need to do is basically set your inventory system in Config.Inventory and you are all set.

If you are not using any of the preconfigured inventories, set the option to 'custom'.

  • Please note that you have to integrate exports/functions yourself! It's not our job to support for 3rd party paid inventory.

  • We strongly recommend to reach out to your inventory creator to ask them to help you integrate their resource.

  • You can suggest compatibility on our discord and we might reach out to the creator of said inventory to possibly add preconfigured support.

Functions

These are the functions used in our T1GER resources.

These are also the functions you want to modify in case you want to integrate your custom inventory resource. Simply use 'custom' in Config.Inventory and integrate your export/functions in the if/else statements for 'custom'.

OpenStash

t1ger_lib/client/framework.lua

Used when player in-game opens a shared/stash inventory. Usually in my resources, owner is nil.

OpenStash(id, label, slots, weight, owner)
-- parameters: id(string), label(string), slots(int), weight(int), owner(string)
-- void: client-function to open the stash/inventory. Commonly used parameters are parsed as u can see.

CreateStash

t1ger_lib/server/framework.lua

Used when creating a stash first time (example when creating a storage marker). Not all inventories require this function to be ran.

CreateStash(id, label, slots, weight, owner)
-- parameters: id(string), label(string), slots(int), weight(int), owner(string)
-- void: server-function to create/register stash first time when creating for example a marker.

RegisterStash

t1ger_lib/server/framework.lua

Used when restarting resource or starting up server. Some inventories requires stashes/storages to be registered/created manually.

RegisterStash(id, label, slots, weight, owner)
-- parameters: id(string), label(string), slots(int), weight(int), owner(string)
-- void: server-function to register stash on resource startup

StashAddItem

t1ger_lib/server/framework.lua

Used when need to add an item directly into a stash/storage. The stash/storage identifier string is also parsed as an argument in this function.

StashAddItem(storageId, item, amount)
-- parameters: storageId(string), item(string), amount(int)
-- void: adds x amount of item into stash/storage with given id/identifier for the stash

QB Inventory Not Opening

By default, t1ger_lib will support latest qb-inventory. If you may for whatever reason, still be using the old qb-inventory, then follow these instructions:

t1ger_lib/client/framework.lua

Find the function called OpenStash and you should see the following code:

Now, all u need to do is simply commenting out the TriggerServerEvent and enabling the other code that has already been commented out.

You can also replace your whole OpenStash function with this snippet, where I have made the changes for you:

    OpenStash = function(id, label, slots, weight, owner)
        if Config.Inventory == 'ox-inventory' then
            exports.ox_inventory:openInventory('stash', {id = id})
        elseif Config.Inventory == 'qb-inventory' then
            --TriggerServerEvent('t1ger_lib:server:openInventory', id, label, slots, weight, owner)
            TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, {
                maxweight = weight,
                slots = slots
            })
            TriggerEvent('inventory:client:SetCurrentStash', id)
        elseif Config.Inventory == 'mf-inventory' then
            exports['mf-inventory']:openOtherInventory(id)
        elseif Config.Inventory == 'qs-inventory' then
            local other = {}
            other.maxweight = weight 
            other.slots = slots 
            TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'Stash_'..id, other)
            TriggerEvent('inventory:client:SetCurrentStash', 'Stash_'..id)
        elseif Config.Inventory == 'core-inventory' then
            TriggerServerEvent('core_inventory:server:openInventory', 'stash-'..id:gsub('/',''):gsub(':',''):gsub('#',''), 'stash', nil, nil)
        elseif Config.Inventory == 'custom' then
            -- export/event to open stash/storage inventory
        end
    end,

Last updated