From e486738bc1465785f42265dcbcbacb8af7fd5c92 Mon Sep 17 00:00:00 2001 From: Maximus7474 Date: Tue, 27 Jan 2026 22:36:14 +0100 Subject: [PATCH] fix(client): weaponwheel manual override being "cancelled" by exiting vehicle fix(client): weaponwheel manual override being "cancelled" by exiting vehicle --- modules/utils/client.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) 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)