Main/resources/[carscripts]/slashtires/bridge/inventory/qb/client.lua
2025-06-07 08:51:21 +02:00

22 lines
780 B
Lua

local function onWeaponEquipped(weaponHash)
TriggerEvent('slashtires:slashWeaponEquipped', Config.AllowedWeapons[weaponHash] ~= nil)
end
AddEventHandler('qb-weapons:client:SetCurrentWeapon', function(weaponData)
local hash = weaponData?.name and joaat(weaponData.name) or `weapon_unarmed`
onWeaponEquipped(hash)
end)
-- For older versions of qb-inventory
AddEventHandler('weapons:client:SetCurrentWeapon', function(weaponData)
local hash = weaponData?.name and joaat(weaponData.name) or `weapon_unarmed`
onWeaponEquipped(hash)
end)
-- For debugging
SetTimeout(0, function()
local currentWeapon = GetSelectedPedWeapon(PlayerPedId())
if currentWeapon ~= `weapon_unarmed` then
onWeaponEquipped(currentWeapon)
end
end)