Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions modules/utils/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down