Skip to main content

qb-inventory installation

I can't equip my Smokegrenade / I can't throw it / It does not explode

Ensure that you have configured qb-inventory correctly.

Example configuration

qb-core

Add

['weapon_smok2grenade'] = {
['name'] = 'weapon_smok2grenade',
['label'] = 'Smokegrenade',
['weight'] = 1000,
['type'] = 'weapon',
['ammotype'] = nil,
['image'] = 'weapon_smok2grenade.png',
['unique'] = true,
['useable'] = false,
['description'] = 'Your description for weapon_smok2grenade'
},

right before definition of weapon_grenade under throwables section.

shared/items.lua:114
    -- Throwables
['weapon_smok2grenade'] = {
['name'] = 'weapon_smok2grenade',
['label'] = 'Smokegrenade',
['weight'] = 1000,
['type'] = 'weapon',
['ammotype'] = nil,
['image'] = 'weapon_smok2grenade.png',
['unique'] = true,
['useable'] = false,
['description'] = 'Your description for weapon_smok2grenade'
},
['weapon_grenade'] = {['name'] = 'weapon_grenade', ['label'] = 'Grenade', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'weapon_grenade.png', ['unique'] = true, ['useable'] = false, ['description'] = 'A handheld throwable bomb'},
['weapon_bzgas'] = {['name'] = 'weapon_bzgas', ['label'] = 'BZ Gas', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'weapon_bzgas.png', ['unique'] = true, ['useable'] = false, ['description'] = 'A cannister of gas that causes extreme pain'},
['weapon_molotov'] = {['name'] = 'weapon_molotov', ['label'] = 'Molotov', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'weapon_molotov.png', ['unique'] = true, ['useable'] = false, ['description'] = 'A crude bomb made of a bottle filled with a flammable liquid and fitted with a wick for lighting'},
['weapon_stickybomb'] = {['name'] = 'weapon_stickybomb', ['label'] = 'C4', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'weapon_stickybomb.png', ['unique'] = true, ['useable'] = false, ['description'] = 'An explosive charge covered with an adhesive that when thrown against an object sticks until it explodes'},
['weapon_proxmine'] = {['name'] = 'weapon_proxmine', ['label'] = 'Proxmine Grenade', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'weapon_proximitymine.png', ['unique'] = true, ['useable'] = false, ['description'] = 'A bomb placed on the ground that detonates when going within its proximity'},
['weapon_snowball'] = {['name'] = 'weapon_snowball', ['label'] = 'Snowball', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'weapon_snowball.png', ['unique'] = true, ['useable'] = false, ['description'] = 'A ball of packed snow, especially one made for throwing at other people for fun'},
['weapon_pipebomb'] = {['name'] = 'weapon_pipebomb', ['label'] = 'Pipe Bomb', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'weapon_pipebomb.png', ['unique'] = true, ['useable'] = false, ['description'] = 'A homemade bomb, the components of which are contained in a pipe'},
['weapon_ball'] = {['name'] = 'weapon_ball', ['label'] = 'Ball', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = 'AMMO_BALL', ['image'] = 'weapon_ball.png', ['unique'] = true, ['useable'] = false, ['description'] = 'A solid or hollow spherical or egg-shaped object that is kicked, thrown, or hit in a game'},
['weapon_smokegrenade'] = {['name'] = 'weapon_smokegrenade', ['label'] = 'Smoke Grenade', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'weapon_c4.png', ['unique'] = true, ['useable'] = false, ['description'] = 'An explosive charge that can be remotely detonated'},
['weapon_flare'] = {['name'] = 'weapon_flare', ['label'] = 'Flare pistol', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = 'AMMO_FLARE', ['image'] = 'weapon_flare.png', ['unique'] = true, ['useable'] = false, ['description'] = 'A small pyrotechnic devices used for illumination and signalling'},

Add

[`weapon_smok2grenade`] = {
['name'] = 'weapon_smok2grenade',
['label'] = 'Smokegrenade',
['weapontype'] = 'Throwable',
['ammotype'] = nil,
['damagereason'] = 'Died'
},

right before definition of weapon_grenade under throwables section.

shared/weapons.lua:117
    -- Throwables
[`weapon_smok2grenade`] = {
['name'] = 'weapon_smok2grenade',
['label'] = 'Smokegrenade',
['weapontype'] = 'Throwable',
['ammotype'] = nil,
['damagereason'] = 'Died'
},
[`weapon_grenade`] = {['name'] = 'weapon_grenade', ['label'] = 'Grenade', ['weapontype'] = 'Throwable', ['ammotype'] = nil, ['damagereason'] = 'Bombed / Exploded / Detonated / Blew up'},
[`weapon_bzgas`] = {['name'] = 'weapon_bzgas', ['label'] = 'BZ Gas', ['weapontype'] = 'Throwable', ['ammotype'] = nil, ['damagereason'] = 'Died'},
[`weapon_molotov`] = {['name'] = 'weapon_molotov', ['label'] = 'Molotov', ['weapontype'] = 'Throwable', ['ammotype'] = nil, ['damagereason'] = 'Torched / Flambeed / Barbecued'},
[`weapon_stickybomb`] = {['name'] = 'weapon_stickybomb', ['label'] = 'C4', ['weapontype'] = 'Throwable', ['ammotype'] = nil, ['damagereason'] = 'Bombed / Exploded / Detonated / Blew up'},
[`weapon_proxmine`] = {['name'] = 'weapon_proxmine', ['label'] = 'Proxmine Grenade', ['weapontype'] = 'Throwable', ['ammotype'] = nil, ['damagereason'] = 'Bombed / Exploded / Detonated / Blew up'},
[`weapon_snowball`] = {['name'] = 'weapon_snowball', ['label'] = 'Snowball', ['weapontype'] = 'Throwable', ['ammotype'] = nil, ['damagereason'] = 'Died'},
[`weapon_pipebomb`] = {['name'] = 'weapon_pipebomb', ['label'] = 'Pipe Bomb', ['weapontype'] = 'Throwable', ['ammotype'] = nil, ['damagereason'] = 'Bombed / Exploded / Detonated / Blew up'},
[`weapon_ball`] = {['name'] = 'weapon_ball', ['label'] = 'Ball', ['weapontype'] = 'Throwable', ['ammotype'] = 'AMMO_BALL', ['damagereason'] = 'Died'},
[`weapon_smokegrenade`] = {['name'] = 'weapon_smokegrenade', ['label'] = 'Smoke Grenade', ['weapontype'] = 'Throwable', ['ammotype'] = nil, ['damagereason'] = 'Died'},
[`weapon_flare`] = {['name'] = 'weapon_flare', ['label'] = 'Flare pistol', ['weapontype'] = 'Throwable', ['ammotype'] = 'AMMO_FLARE', ['damagereason'] = 'Died'},

qb-inventory

Add weaponName == "weapon_smok2grenade" or in elseif section in line 556, under inventory:client:UseWeapon event handler.

client/main.lua:546
RegisterNetEvent('inventory:client:UseWeapon', function(weaponData, shootbool)
local ped = PlayerPedId()
local weaponName = tostring(weaponData.name)
local weaponHash = joaat(weaponData.name)
if currentWeapon == weaponName then
TriggerEvent('weapons:client:DrawWeapon', nil)
SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
RemoveAllPedWeapons(ped, true)
TriggerEvent('weapons:client:SetCurrentWeapon', nil, shootbool)
currentWeapon = nil
elseif weaponName == "weapon_smok2grenade" or weaponName == "weapon_stickybomb" or weaponName == "weapon_pipebomb" or weaponName == "weapon_smokegrenade" or weaponName == "weapon_flare" or weaponName == "weapon_proxmine" or weaponName == "weapon_ball" or weaponName == "weapon_molotov" or weaponName == "weapon_grenade" or weaponName == "weapon_bzgas"
then
TriggerEvent('weapons:client:DrawWeapon', weaponName)
GiveWeaponToPed(ped, weaponHash, 1, false, false)
SetPedAmmo(ped, weaponHash, 1)
SetCurrentPedWeapon(ped, weaponHash, true)
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData, shootbool)
currentWeapon = weaponName
elseif weaponName == "weapon_snowball" then
TriggerEvent('weapons:client:DrawWeapon', weaponName)
GiveWeaponToPed(ped, weaponHash, 10, false, false)
SetPedAmmo(ped, weaponHash, 10)
SetCurrentPedWeapon(ped, weaponHash, true)
TriggerServerEvent('inventory:server:snowball', 'remove')
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData, shootbool)
currentWeapon = weaponName
else
TriggerEvent('weapons:client:DrawWeapon', weaponName)
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData, shootbool)
local ammo = tonumber(weaponData.info.ammo) or 0

if weaponName == "weapon_petrolcan" or weaponName == "weapon_fireextinguisher" then
ammo = 4000
end

GiveWeaponToPed(ped, weaponHash, ammo, false, false)
SetPedAmmo(ped, weaponHash, ammo)
SetCurrentPedWeapon(ped, weaponHash, true)

if weaponData.info.attachments then
for _, attachment in pairs(weaponData.info.attachments) do
GiveWeaponComponentToPed(ped, weaponHash, joaat(attachment.component))
end
end

currentWeapon = weaponName
end
end)

qb-hud

Add `weapon_smok2grenade`, after throwables in Config.WhitelistedWeaponArmed section to make it look like this:

config.lua:12
Config.WhitelistedWeaponArmed = { -- weapons specifically whitelisted to not show armed mode
-- miscellaneous
`weapon_petrolcan`,
`weapon_hazardcan`,
`weapon_fireextinguisher`,
-- melee
`weapon_dagger`,
`weapon_bat`,
`weapon_bottle`,
`weapon_crowbar`,
`weapon_flashlight`,
`weapon_golfclub`,
`weapon_hammer`,
`weapon_hatchet`,
`weapon_knuckle`,
`weapon_knife`,
`weapon_machete`,
`weapon_switchblade`,
`weapon_nightstick`,
`weapon_wrench`,
`weapon_battleaxe`,
`weapon_poolcue`,
`weapon_briefcase`,
`weapon_briefcase_02`,
`weapon_garbagebag`,
`weapon_handcuffs`,
`weapon_bread`,
`weapon_stone_hatchet`,
-- throwables

`weapon_smok2grenade`, -- add smokegrenade here

`weapon_grenade`,
`weapon_bzgas`,
`weapon_molotov`,
`weapon_stickybomb`,
`weapon_proxmine`,
`weapon_snowball`,
`weapon_pipebomb`,
`weapon_ball`,
`weapon_smokegrenade`,
`weapon_flare`
}

qb-weapons

Check in server/main.lua callback prison:server:checkThrowable. If it looks like this:

QBCore.Functions.CreateCallback('prison:server:checkThrowable', function(source, cb, weapon)
local Player = QBCore.Functions.GetPlayer(source)

if not Player then return cb(false) end

if QBCore.Shared.Weapons[weapon]["name"] == "weapon_snowball" then
Player.Functions.RemoveItem("weapon_snowball", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_pipebomb" then
Player.Functions.RemoveItem("weapon_pipebomb", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_molotov" then
Player.Functions.RemoveItem("weapon_molotov", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_stickybomb" then
Player.Functions.RemoveItem("weapon_stickybomb", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_grenade" then
Player.Functions.RemoveItem("weapon_grenade", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_bzgas" then
Player.Functions.RemoveItem("weapon_bzgas", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_proxmine" then
Player.Functions.RemoveItem("weapon_proxmine", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_ball" then
Player.Functions.RemoveItem("weapon_ball", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_smokegrenade" then
Player.Functions.RemoveItem("weapon_smokegrenade", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_flare" then
Player.Functions.RemoveItem("weapon_flare", 1)
else
return cb(false)
end
cb(true)
end)

You gonna add weapon_smok2grenade here too. To make it look more like this:

QBCore.Functions.CreateCallback('prison:server:checkThrowable', function(source, cb, weapon)
local Player = QBCore.Functions.GetPlayer(source)

if not Player then return cb(false) end

if QBCore.Shared.Weapons[weapon]["name"] == "weapon_snowball" then
Player.Functions.RemoveItem("weapon_snowball", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_pipebomb" then
Player.Functions.RemoveItem("weapon_pipebomb", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_molotov" then
Player.Functions.RemoveItem("weapon_molotov", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_stickybomb" then
Player.Functions.RemoveItem("weapon_stickybomb", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_grenade" then
Player.Functions.RemoveItem("weapon_grenade", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_bzgas" then
Player.Functions.RemoveItem("weapon_bzgas", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_proxmine" then
Player.Functions.RemoveItem("weapon_proxmine", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_ball" then
Player.Functions.RemoveItem("weapon_ball", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_smokegrenade" then
Player.Functions.RemoveItem("weapon_smokegrenade", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_flare" then
Player.Functions.RemoveItem("weapon_flare", 1)
elseif QBCore.Shared.Weapons[weapon]["name"] == "weapon_smok2grenade" then
Player.Functions.RemoveItem("weapon_smok2grenade", 1)
else
return cb(false)
end
cb(true)
end)

Add "smok2grenade", at the end of Config.Throwables section in config.lua.

config.lua:12
Config.Throwables = {
"ball",
"bzgas",
"flare",
"grenade",
"molotov",
"pipebomb",
"proxmine",
"smokegrenade",
"snowball",
"stickybomb",
"smok2grenade",
}

Add ['weapon_smok2grenade'] = 0.15, right after throwables in Config.DurabilityMultiplier.

config.lua:136
Config.DurabilityMultiplier = {
-- Melee
-- ['weapon_unarmed'] = 0.15,
['weapon_dagger'] = 0.15,
['weapon_bat'] = 0.15,
['weapon_bottle'] = 0.15,
['weapon_crowbar'] = 0.15,
-- ['weapon_flashlight'] = 0.15,
['weapon_golfclub'] = 0.15,
['weapon_hammer'] = 0.15,
['weapon_hatchet'] = 0.15,
['weapon_knuckle'] = 0.15,
['weapon_knife'] = 0.15,
['weapon_machete'] = 0.15,
['weapon_switchblade'] = 0.15,
-- ['weapon_nightstick'] = 0.15,
['weapon_wrench'] = 0.15,
['weapon_battleaxe'] = 0.15,
['weapon_poolcue'] = 0.15,
['weapon_briefcase'] = 0.15,
['weapon_briefcase_02'] = 0.15,
['weapon_garbagebag'] = 0.15,
['weapon_handcuffs'] = 0.15,
['weapon_bread'] = 0.15,
['weapon_stone_hatchet'] = 0.15,

-- Handguns
['weapon_pistol'] = 0.15,
['weapon_pistol_mk2'] = 0.15,
['weapon_combatpistol'] = 0.15,
['weapon_appistol'] = 0.15,
-- ['weapon_stungun'] = 0.15,
-- ['weapon_stungun_mp'] = 0.15,
['weapon_pistol50'] = 0.15,
['weapon_snspistol'] = 0.15,
['weapon_heavypistol'] = 0.15,
['weapon_vintagepistol'] = 0.15,
['weapon_flaregun'] = 0.15,
['weapon_marksmanpistol'] = 0.15,
['weapon_revolver'] = 0.15,
['weapon_revolver_mk2'] = 0.15,
['weapon_doubleaction'] = 0.15,
['weapon_snspistol_mk2'] = 0.15,
['weapon_raypistol'] = 0.15,
['weapon_ceramicpistol'] = 0.15,
['weapon_navyrevolver'] = 0.15,
['weapon_gadgetpistol'] = 0.15,

-- Submachine Guns
['weapon_microsmg'] = 0.15,
['weapon_smg'] = 0.15,
['weapon_smg_mk2'] = 0.15,
['weapon_assaultsmg'] = 0.15,
['weapon_combatpdw'] = 0.15,
['weapon_machinepistol'] = 0.15,
['weapon_minismg'] = 0.15,
['weapon_raycarbine'] = 0.15,

-- Shotguns
['weapon_pumpshotgun'] = 0.15,
['weapon_sawnoffshotgun'] = 0.15,
['weapon_assaultshotgun'] = 0.15,
['weapon_bullpupshotgun'] = 0.15,
['weapon_musket'] = 0.15,
['weapon_heavyshotgun'] = 0.15,
['weapon_dbshotgun'] = 0.15,
['weapon_autoshotgun'] = 0.15,
['weapon_pumpshotgun_mk2'] = 0.15,
['weapon_combatshotgun'] = 0.15,

-- Assault Rifles
['weapon_assaultrifle'] = 0.15,
['weapon_assaultrifle_mk2'] = 0.15,
['weapon_carbinerifle'] = 0.15,
['weapon_carbinerifle_mk2'] = 0.15,
['weapon_advancedrifle'] = 0.15,
['weapon_specialcarbine'] = 0.15,
['weapon_bullpuprifle'] = 0.15,
['weapon_compactrifle'] = 0.15,
['weapon_specialcarbine_mk2'] = 0.15,
['weapon_bullpuprifle_mk2'] = 0.15,
['weapon_militaryrifle'] = 0.15,
['weapon_heavyrifle'] = 0.15,

-- Light Machine Guns
['weapon_mg'] = 0.15,
['weapon_combatmg'] = 0.15,
['weapon_gusenberg'] = 0.15,
['weapon_combatmg_mk2'] = 0.15,

-- Sniper Rifles
['weapon_sniperrifle'] = 0.15,
['weapon_heavysniper'] = 0.15,
['weapon_marksmanrifle'] = 0.15,
['weapon_remotesniper'] = 0.15,
['weapon_heavysniper_mk2'] = 0.15,
['weapon_marksmanrifle_mk2'] = 0.15,

-- Heavy Weapons
['weapon_rpg'] = 0.15,
['weapon_grenadelauncher'] = 0.15,
['weapon_grenadelauncher_smoke']= 0.15,
['weapon_emplauncher'] = 0.15,
['weapon_minigun'] = 0.15,
['weapon_firework'] = 0.15,
['weapon_railgun'] = 0.15,
['weapon_hominglauncher'] = 0.15,
['weapon_compactlauncher'] = 0.15,
['weapon_rayminigun'] = 0.15,

-- Throwables
['weapon_smok2grenade'] = 0.15, -- add smokegrenade here
['weapon_grenade'] = 0.15,
['weapon_bzgas'] = 0.15,
['weapon_molotov'] = 0.15,
['weapon_stickybomb'] = 0.15,
['weapon_proxmine'] = 0.15,
['weapon_snowball'] = 0.15,
['weapon_pipebomb'] = 0.15,
['weapon_ball'] = 0.15,
['weapon_smokegrenade'] = 0.15,
['weapon_flare'] = 0.15,

-- Miscellaneous
['weapon_petrolcan'] = 0.15,
['weapon_fireextinguisher'] = 0.15,
['weapon_hazardcan'] = 0.15,
['weapon_fertilizercan'] = 0.15,
}