diff --git a/modules/utils/client.lua b/modules/utils/client.lua index bb48f8b4f..12b6f31a7 100644 --- a/modules/utils/client.lua +++ b/modules/utils/client.lua @@ -114,12 +114,23 @@ end local rewardTypes = 1 << 0 | 1 << 1 | 1 << 2 | 1 << 3 | 1 << 7 | 1 << 10 --- Enables the weapon wheel, but disables the use of inventory weapons. --- Mostly used for weaponised vehicles, though could be called for "minigames" -function Utils.WeaponWheel(state) +local weaponWheelOverride = false + +---Enables the weapon wheel, but disables the use of inventory weapons. +---Mostly used for weaponised vehicles, though could be called for "minigames" +---@param state boolean +---@param override boolean +function Utils.WeaponWheel(state, override) + if not override and weaponWheelOverride and state == false then + return + end if client.disableweapons then state = true end if state == nil then state = EnableWeaponWheel end + if override then + weaponWheelOverride = state + end + EnableWeaponWheel = state SetWeaponsNoAutoswap(not state) SetWeaponsNoAutoreload(not state) @@ -130,7 +141,9 @@ function Utils.WeaponWheel(state) end end -exports('weaponWheel', Utils.WeaponWheel) +exports('weaponWheel', function (state) + Utils.WeaponWheel(state, true) +end) function Utils.CreateBlip(settings, coords) local blip = AddBlipForCoord(coords.x, coords.y, coords.z)