#Qbox with Ox Inventory (v2.44.1) Give item nearby player problem

1 messages · Page 1 of 1 (latest)

steady basin
#

Hello everyone, if anyone can help, I'd appreciate it. I'm having an issue with ox_inventory together with qbox. The function to give an item to a nearby player only works when I run an ensure via F8. After talking with the community, it initially seemed like a loading order issue in the cfg. But (apparently) I'm using it correctly, and the console shows everything loading in order. I'll share a video and my cfg here—if anyone has any tips, I'd really appreciate it.

Qbox config

setr qb_locale "en"
setr qbx:enableBridge "true" # When true, enables the qb-core bridge for qbx_core
set qbx:enableQueue "true" # When true, enables qbx_core's built-in queue system
set qbx:bucketLockdownMode "inactive" # Sets the lockdown mode as inactive read here: https://docs.fivem.net/natives/?_0xA0F2201F
set qbx:discordLink "discord.gg/qbox" # Sets the servers discord link
set qbx:max_jobs_per_player 1 # Sets the number of jobs per player
set qbx:max_gangs_per_player 1 # Sets the number of gangs per player
set qbx:setjob_replaces "true" # When true, the SetJob function deletes the previous primary job of the player before setting the new one
set qbx:setgang_replaces "true" # When true, the SetGang function deletes the previous primary gang of the player before setting the new one
set qbx:cleanPlayerGroups "true" # When true, on server startup, the database will be checked for any groups/grades players have that are not in config files and removes them from the database if so
set qbx:allowMethodOverrides "true" # When true, enables the ability of resources to override existing methods in the player object
set qbx:disableOverrideWarning "false" # When true, disables warnings from resources overriding existing methods in the player object
setr qbx:enableVehiclePersistence "false" # When true, player vehicles marked for persistence will be respawned when deleted
setr crm-core:language "pt"

Ox resources config

exec ox.cfg

loadscreen config

setr loadscreen:externalShutdown true
set loadscreen:primaryColor "#f1e542"
set loadscreen:shadowColor "#1a18077f"

These resources will start by default.

ensure mapmanager
ensure spawnmanager
ensure sessionmanager
stop basic-gamemode
ensure hardcap
ensure baseevents

Qbox & Extra stuff

ensure oxmysql
ensure ox_lib
ensure qbx_core
ensure ox_target
ensure ox_inventory
ensure [ox]
ensure [qbx]
ensure [standalone]

Cfx.re Native Reference

Sets the entity lockdown mode for a specific routing bucket.

Lockdown modes are:

Mode Meaning
proper hatch
#

first I'd get rid of your reskin and test to help rule out if its an ox_inventory issue or a reskin issue

proper hatch
#

youre not using base, unedited, ox_inventory
you have a reskin of it

steady basin
proper hatch
#

I would try that, yea

steady basin
#

I have this file exec ox.cfg

ox.cfg in same place as server.cfg, maybe this must be inside ox inventory folder?

steady basin
#

The matter looks to be something here:

ocal function giveItem(playerId, slot, target, count)
    local fromInventory = Inventory(playerId)
    local toInventory = Inventory(target)

    if count <= 0 then count = 1 end

    if toInventory?.player then
        local data = fromInventory.items[slot]

        if not data then return end

        local targetState = Player(target).state
        print(('GiveItem failed: invBusy=%s | dist=%.2f'):format(
    tostring(targetState.invBusy),
    #(GetEntityCoords(fromInventory.player.ped) - GetEntityCoords(toInventory.player.ped))
))

        if targetState.invBusy then
            return { 'cannot_give', count, data.label }
        end

        local item = Items(data.name)

        if not item or data.count < count or not Inventory.CanCarryItem(toInventory, item, count, data.metadata) or #(GetEntityCoords(fromInventory.player.ped) - GetEntityCoords(toInventory.player.ped)) > 15 then
            return { 'cannot_give', count, data.label }
        end

        local toSlot = Inventory.GetSlotForItem(toInventory, data.name, data.metadata)
        local fromRef = ('%s:%s'):format(fromInventory.id, slot)
        local toRef = ('%s:%s'):format(toInventory.id, toSlot)

        if activeSlots[fromRef] or activeSlots[toRef] then
            return { 'cannot_give', count, data.label }
        end

        activeSlots[fromRef] = true
        activeSlots[toRef] = true

        local _ <close> = defer(function()
            activeSlots[fromRef] = nil
            activeSlots[toRef] = nil
        end)

        if TriggerEventHooks('swapItems', {
            source = fromInventory.id,
            fromInventory = fromInventory.id,
            fromType = fromInventory.type,
            toInventory = toInventory.id,
            toType = toInventory.type,
            count = count,
            action = 'give',
            fromSlot = data,
        }) then
            ---@todo manually call swapItems or something?
            if Inventory.AddItem(toInventory, item, count, data.metadata, toSlot) then
                if Inventory.RemoveItem(fromInventory, item, count, data.metadata, slot) then
                    if server.loglevel > 0 then
                        lib.logger(fromInventory.owner, 'giveItem', ('"%s" gave %sx %s to "%s"'):format(fromInventory.label, count, data.name, toInventory.label))
                    end

                    return
                end
            end
        end

        return { 'cannot_give', count, data.label }
    end
end```

I put the print and when try to give the item return this:  ```[ script:ox_inventory] GiveItem failed: invBusy=true | dist=0.96```
coral charm
#

Hello, I want to know if this problem has been solved, because I also encountered the same problem

robust elbow