Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide hud components #126

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 10 additions & 8 deletions qbx_hudcomponents/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ local disableControls = config.disable.controls
local displayAmmo = config.disable.displayAmmo

CreateThread(function()

for i = 1, #disableHudComponents do
SetHudComponentSize(disableHudComponents[i],0.0,0.0)
end

while true do

for i = 1, #disableHudComponents do
HideHudComponentThisFrame(disableHudComponents[i])
end

for i = 1, #disableControls do
DisableControlAction(2, disableControls[i], true)
end

DisplayAmmoThisFrame(displayAmmo)

Wait(0)
end
end)
Expand All @@ -23,9 +22,11 @@ local function addDisableHudComponents(hudComponents)
local hudComponentsType = type(hudComponents)
if hudComponentsType == 'number' then
disableHudComponents[#disableHudComponents+1] = hudComponents
SetHudComponentSize(hudComponents,0.0,0.0)
elseif hudComponentsType == 'table' and table.type(hudComponents) == 'array' then
for i = 1, #hudComponents do
disableHudComponents[#disableHudComponents+1] = hudComponents[i]
SetHudComponentSize(hudComponents,0.0,0.0)
end
end
end
Expand All @@ -40,14 +41,15 @@ local function removeDisableHudComponents(hudComponents)
for i = 1, #disableHudComponents do
if disableHudComponents[i] == hudComponents then
table.remove(disableHudComponents, i)
ResetHudComponentValues(i)
break
end
end
elseif hudComponentsType == 'table' and table.type(hudComponents) == 'array' then
for i = 1, #disableHudComponents do
for i2 = 1, #hudComponents do
if disableHudComponents[i] == hudComponents[i2] then
table.remove(disableHudComponents, i)
ResetHudComponentValues(i)
end
end
end
Expand Down
3 changes: 0 additions & 3 deletions qbx_hudcomponents/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ return {

-- https://docs.fivem.net/docs/game-references/controls/
controls = {37},

-- False disables ammo display
displayAmmo = true,
}
}