QS-Inventory snippets

There are only two functions for inventories. You can find them in server/inventory/*.lua its different for many inventories.

These functions above is for qs-inventory:

One of them is giveItem function:

--- @param src number
--- @param type string
--- @param count number
function giveItem(src, item, count)
    exports['qs-inventory']:AddItem(src, item, count)
    notify.send(src, string.format(Locales.Get("GOT_ITEM"), count, item), 2500)
end

And the second one is canCarry function:

--- @param src number
--- @param type string
--- @param count number
function canCarry(src, item, count)
    if exports['qs-inventory']:CanCarryItem(src, item, count) then
        return true
    else
        notify.send(src, Locales.Get('NOT_E_SPACE'), 'info', 2500)
    end
end
  1. Make new file in server/inventory/[name-of-inventory].lua

  2. Add new enum for your inv in shared/enum.lua Just like that: Inventory = { OXInventory = 1, QBInventory = 2, ESXInventory = 3, [YOUR-INVENTORY] = 4 }

  3. And thats it, only you need to do is change number to yours Config.InventorySystem = 4

if Config.InventorySystem == Inventory.[YOUR-INVENTORY] then
    -- Here you can insert these two functions
end

Last updated