Skip to content

Commit

Permalink
improve noidle logic + add config
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathu-lmn committed Jan 26, 2025
1 parent e6142fc commit a2ec35f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions client/NoIdleCam.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
if not Config.NoIdleCam then return end

RegisterCommand('idlecamoff', function() -- help2 31, 167, 9
TriggerEvent('chat:addMessage', {
color = {227,8,0},
Expand All @@ -6,7 +8,7 @@ RegisterCommand('idlecamoff', function() -- help2 31, 167, 9
})
DisableIdleCamera(true)
SetPedCanPlayAmbientAnims(PlayerPedId(), false)
SetResourceKvpInt("idleCam", 0)
SetResourceKvpInt("idleCam", 1)
end, false)

RegisterCommand('idlecamon', function() -- help2 31, 167, 9
Expand All @@ -17,18 +19,17 @@ RegisterCommand('idlecamon', function() -- help2 31, 167, 9
})
DisableIdleCamera(false)
SetPedCanPlayAmbientAnims(PlayerPedId(), true)
SetResourceKvpInt("idleCam", 1)
SetResourceKvpInt("idleCam", 2)
end, false)

CreateThread(function()
TriggerEvent("chat:addSuggestion", "/idlecamon", "Re-enables the idle cam")
TriggerEvent("chat:addSuggestion", "/idlecamoff", "Disables the idle cam")

local idleCamKvp = GetResourceKvpInt("idleCam")
if idleCamKvp ~= 0 and idleCamKvp ~= 1 then
if idleCamKvp == 0 then
return
end

local idleCamDisabled = idleCamKvp == 0
DisableIdleCamera(idleCamDisabled)
DisableIdleCamera(idleCamKvp == 1)
end)
2 changes: 2 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Config = {
-- News Camera Options
NewscamEnabled = false, -- If set to true, the /newscam command will be enabled.

NoIdleCam = true, -- Controls wether the idle cam can be disabled by players or not

-- Preview Ped Options
PreviewPed = true, -- Shows a preview of the emote on the player's ped next to the emote menu. Note that resmon will increase when this when emotes are being previewed.

Expand Down

0 comments on commit a2ec35f

Please sign in to comment.