forked from Simnation/Main
22 lines
780 B
Lua
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)
|