QB Inventory Patch Guide

Patch instructions for running oxide-newspaperjob on stock qb-inventory and qb-weapons.

Patch instructions for running oxide-newspaperjob on stock qb-inventory + qb-weapons.

Hotbar sync issues observed on qb-inventory.

During testing on a stock qb-inventory setup, hotbar slots (1-5) only worked for items that were already in those slots when the player loaded in. Items moved into a previously empty hotbar slot during the session did not become usable from that key. The trigger is not clear and the issue may not appear on every server.

Recommendation: use ox_inventory instead. It is the better-supported path for this resource — follow the ox_inventory section of the Installation Guide if you can.

Background

The throw flow gives the player a weapon_newspaper item whose underlying GTA weapon is WEAPON_ACIDPACKAGE — the real projectile that animates and damages targets.

ox_inventory exposes a model field on the weapon entry to override what joaat() is called on. qb-inventory does not have an equivalent field; it always derives the weapon hash from joaat(item.name). As a result, weapon_newspaper resolves to a non-existent GTA weapon and fails to draw without the changes below.

This guide covers four edits:

  1. Register weapon_newspaper as a QBCore item.
  2. Register weapon_newspaper as a QBCore weapon.
  3. Remap weapon_newspaper to WEAPON_ACIDPACKAGE in qb-weapons.
  4. Extend qb-inventory's checkWeapon so the held projectile is removed when the item is cleared from inventory.

For ox_inventory setups, follow the ox_inventory section of the Installation Guide instead.

Patches

Register the item

Edit qb-core/shared/items.lua. In the throwables section (next to weapon_flare), add:

qb-core/shared/items.lua
weapon_newspaper             = { name = 'weapon_newspaper', label = 'Newspaper', weight = 50, type = 'weapon', ammotype = nil, image = 'weapon_newspaper.png', unique = true, useable = true, description = 'A rolled-up newspaper, ready for delivery' },

Field notes:

  • image references a file inside qb-inventory/html/images/. Place weapon_newspaper.png in that folder, or change this field to an existing image such as 'weapon_snowball.png'.
  • useable = true is needed for the click and right-click "Use" paths in the qb-inventory UI to forward the item to the server. The server's useItem handler routes weapon-type items through qb-weapons:client:UseWeapon based on type == 'weapon', so this setting does not invoke any UseItem callback.
  • unique = true keeps each stack as its own slot so per-item ammo metadata is preserved.

Register the weapon

Edit qb-core/shared/weapons.lua. In the Throwables section (next to weapon_flare), add:

qb-core/shared/weapons.lua
[`weapon_newspaper`]             = { name = 'weapon_newspaper', label = 'Newspaper', weapontype = 'Throwable', ammotype = nil, damagereason = 'Died' },

qb-inventory uses this entry when matching the player's currently held weapon to an inventory item.

Patch qb-weapons

Edit qb-weapons/client/main.lua. Inside the qb-weapons:client:UseWeapon event handler, add a weapon_newspaper branch immediately after the weapon_snowball branch:

qb-weapons/client/main.lua
elseif weaponName == 'weapon_newspaper' then
    local realHash = `WEAPON_ACIDPACKAGE`
    local ammo = tonumber(weaponData.info and weaponData.info.ammo) or 1
    TriggerEvent('qb-weapons:client:DrawWeapon', weaponName)
    GiveWeaponToPed(ped, realHash, ammo, false, false)
    SetPedAmmo(ped, realHash, ammo)
    SetCurrentPedWeapon(ped, realHash, true)
    TriggerEvent('qb-weapons:client:SetCurrentWeapon', weaponData, shootbool)
    currentWeapon = weaponName

Behavior:

  • The actual weapon hash given to the ped is WEAPON_ACIDPACKAGE rather than joaat('weapon_newspaper').
  • Ammo is read from weaponData.info.ammo, which the resource sets via olink.inventory.AddItem(..., { ammo = routeData.ammoCount }).
  • currentWeapon is tracked as 'weapon_newspaper' so the existing toggle-off branch at the top of the handler clears the projectile via RemoveAllPedWeapons.

Patch qb-inventory

Edit qb-inventory/server/main.lua. Replace the checkWeapon function (around line 126) with:

qb-inventory/server/main.lua
function checkWeapon(source, item)
    local currentWeapon = type(item) == 'table' and item.name or item
    local ped = GetPlayerPed(source)
    local weapon = GetSelectedPedWeapon(ped)
    local weaponInfo = QBCore.Shared.Weapons[weapon]
    if weaponInfo and weaponInfo.name == currentWeapon then
        RemoveWeaponFromPed(ped, weapon)
        TriggerClientEvent('qb-weapons:client:UseWeapon', source, { name = currentWeapon }, false)
    elseif currentWeapon == 'weapon_newspaper' and weapon == `WEAPON_ACIDPACKAGE` then
        RemoveWeaponFromPed(ped, weapon)
        TriggerClientEvent('qb-weapons:client:UseWeapon', source, { name = currentWeapon }, false)
    end
end

checkWeapon runs when the inventory removes, drops, or transfers a weapon item. The default lookup compares QBCore.Shared.Weapons[heldHash] against the item name — since the player is holding WEAPON_ACIDPACKAGE while the item name is weapon_newspaper, the default branch never matches. The added elseif removes the projectile from the ped when the weapon_newspaper item is cleared.

Restart resources

Restart in this order (or restart the server):

restart qb-core
restart qb-weapons
restart qb-inventory
restart oxide-newspaperjob

Verification

Clock in at the newspaper depot and accept a route.
Open inventory and confirm a weapon_newspaper item is present with the correct ammo count in its metadata.
Equip the item. The character should pull out the acid package projectile.
Throw at a marked house target. The projectile should fire and the route progress should tick.
Run the route to completion or use up all ammo. The projectile should leave the player's hand when the item is removed.
Clock out before running out of ammo and confirm the item is removed and the projectile is no longer held.

Reverting

Undo the four edits to roll back:

  • Remove the weapon_newspaper entry from qb-core/shared/items.lua.
  • Remove the weapon_newspaper entry from qb-core/shared/weapons.lua.
  • Remove the elseif weaponName == 'weapon_newspaper' branch from qb-weapons/client/main.lua.
  • Remove the elseif currentWeapon == 'weapon_newspaper' branch from qb-inventory/server/main.lua.

Notes

  • These patches target stock qb-inventory and qb-weapons. Forks such as qs-inventory, core_inventory, and ps-inventory have different internals; the same approach applies but file paths and field names will differ.
  • For an ox_inventory migration, revert these patches and follow the ox_inventory section of the Installation Guide.

Next Steps