Project-Sloth / ps-adminmenu

An admin menu for QBCore.
https://discord.com/invite/projectsloth
Other
95 stars 72 forks source link

Give Item function in menu doesnt get items from ox_inventory #119

Closed Xerodar closed 3 months ago

Xerodar commented 3 months ago

Describe the bug

A clear and concise description of what the bug is.

Hello, in your client/data.lua code it only gets items from qb-core/shared/items.lua i have more registered items in ox_inventory than qb-core/shared/items.lua and this function idk how only get those items...

local function GetItems()
    local items = {}
    local ItemsData = QBCore.Shared.Items

    if Config.Inventory == "ox_inventory" then
        ItemsData = exports.ox_inventory:Items()
    end

    for name, v in pairs(ItemsData) do
        items[#items + 1] = { label = v.label, value = name }
    end

    return items
end

i also tried with this:

local function GetItems()
    local items = {}
    ItemsData = exports.ox_inventory:Items()

    for name, v in pairs(ItemsData) do
        items[#items + 1] = { label = v.label, value = name }
    end

    return items
end
Xerodar commented 3 months ago

also i tried to combine with this but it doesnt work pretty well.. https://prnt.sc/zak5cExrCHCU

xFutte commented 3 months ago

Just smack all of the items into the itemData table. Otherwise, move the items from one to the other to have it collectively.