Skip to content

Commit

Permalink
feat: drunk soundMode
Browse files Browse the repository at this point in the history
  • Loading branch information
TonybynMp4 committed May 23, 2024
1 parent 257ae16 commit d558d54
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ local sharedConfig = require('config.shared')
local playerState = LocalPlayer.state
local alcoholLevel = playerState.alcohol or 0
local playerWalk
local soundLoop = false

--Apprarently used by R* when drunk, makes car radio inaudible & adds reverb to everything
local function soundModeLoop()
soundLoop = true
CreateThread(function()
while soundLoop and alcoholLevel > 0 do
SetAudioSpecialEffectMode(2)
Wait(0)
end
end)
end

local function resetEffect()
exports.scully_emotemenu:setWalk(playerWalk or 'move_m@casual@a')
Expand Down Expand Up @@ -108,6 +120,12 @@ AddStateBagChangeHandler('alcohol', ('player:%s'):format(cache.serverId), functi
return
end
alcoholLevel = value

if not soundLoop then
soundModeLoop()
elseif alcoholLevel <= 0 then
soundLoop = false
end
end)

RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
Expand Down
2 changes: 2 additions & 0 deletions config/client.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
return {
--- Enables the drunk sound mode, something extra i guess
useDrunkSoundMode = true,
--- delay in ms before the effect is first applied
delayEffect = 15000,
effect = {
Expand Down

0 comments on commit d558d54

Please sign in to comment.