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:
- Register
weapon_newspaperas a QBCore item. - Register
weapon_newspaperas a QBCore weapon. - Remap
weapon_newspapertoWEAPON_ACIDPACKAGEinqb-weapons. - Extend
qb-inventory'scheckWeaponso 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:
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:
imagereferences a file insideqb-inventory/html/images/. Placeweapon_newspaper.pngin that folder, or change this field to an existing image such as'weapon_snowball.png'.useable = trueis needed for the click and right-click "Use" paths in the qb-inventory UI to forward the item to the server. The server'suseItemhandler routes weapon-type items throughqb-weapons:client:UseWeaponbased ontype == 'weapon', so this setting does not invoke anyUseItemcallback.unique = truekeeps 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:
[`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:
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 = weaponNameBehavior:
- The actual weapon hash given to the ped is
WEAPON_ACIDPACKAGErather thanjoaat('weapon_newspaper'). - Ammo is read from
weaponData.info.ammo, which the resource sets viaolink.inventory.AddItem(..., { ammo = routeData.ammoCount }). currentWeaponis tracked as'weapon_newspaper'so the existing toggle-off branch at the top of the handler clears the projectile viaRemoveAllPedWeapons.
Patch qb-inventory
Edit qb-inventory/server/main.lua. Replace the checkWeapon function (around line 126) with:
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
endcheckWeapon 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-newspaperjobVerification
weapon_newspaper item is present with the correct ammo count in its metadata.Reverting
Undo the four edits to roll back:
- Remove the
weapon_newspaperentry fromqb-core/shared/items.lua. - Remove the
weapon_newspaperentry fromqb-core/shared/weapons.lua. - Remove the
elseif weaponName == 'weapon_newspaper'branch fromqb-weapons/client/main.lua. - Remove the
elseif currentWeapon == 'weapon_newspaper'branch fromqb-inventory/server/main.lua.
Notes
- These patches target stock
qb-inventoryandqb-weapons. Forks such asqs-inventory,core_inventory, andps-inventoryhave different internals; the same approach applies but file paths and field names will differ. - For an
ox_inventorymigration, revert these patches and follow theox_inventorysection of the Installation Guide.