From d558d5455a0a75268c184a3ee7f881ef8946127e Mon Sep 17 00:00:00 2001 From: Tony <97451137+TonybynMp4@users.noreply.github.com> Date: Fri, 24 May 2024 00:08:01 +0200 Subject: [PATCH 1/3] feat: drunk soundMode --- client/main.lua | 18 ++++++++++++++++++ config/client.lua | 2 ++ 2 files changed, 20 insertions(+) diff --git a/client/main.lua b/client/main.lua index 5c628ac..7666c6c 100644 --- a/client/main.lua +++ b/client/main.lua @@ -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') @@ -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() diff --git a/config/client.lua b/config/client.lua index 5bffb0f..5ea322d 100644 --- a/config/client.lua +++ b/config/client.lua @@ -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 = { From 517c6f47898fc1881e0e3af260eb1da430971249 Mon Sep 17 00:00:00 2001 From: Tony <97451137+TonybynMp4@users.noreply.github.com> Date: Fri, 24 May 2024 00:09:21 +0200 Subject: [PATCH 2/3] increment version --- fxmanifest.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 77787cb..6c0d4c3 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ game 'gta5' description 'y_alcoholism' authors 'Tonybyn_Mp4' repository 'https://github.com/TonybynMp4/y_alcoholism' -version '1.1.2' +version '1.1.3' shared_scripts { '@ox_lib/init.lua', From 9a2e7f709b477ef121ca14c3d8c13fb7f4f28a91 Mon Sep 17 00:00:00 2001 From: Tony <97451137+TonybynMp4@users.noreply.github.com> Date: Fri, 24 May 2024 01:57:47 +0200 Subject: [PATCH 3/3] better integration --- client/main.lua | 11 ++++++++--- config/client.lua | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/client/main.lua b/client/main.lua index 7666c6c..d59a441 100644 --- a/client/main.lua +++ b/client/main.lua @@ -7,6 +7,8 @@ local soundLoop = false --Apprarently used by R* when drunk, makes car radio inaudible & adds reverb to everything local function soundModeLoop() + if not config.useDrunkSoundMode then return end + soundLoop = true CreateThread(function() while soundLoop and alcoholLevel > 0 do @@ -51,6 +53,11 @@ local function drunkLoop() if severity then drunkEffect(severity) + if not soundLoop and severity.toggleDrunkSounds then + soundModeLoop() + elseif soundLoop and not severity.toggleDrunkSounds then + soundLoop = false + end end Wait(60000 * sharedConfig.alcoholDecayTime) @@ -121,9 +128,7 @@ AddStateBagChangeHandler('alcohol', ('player:%s'):format(cache.serverId), functi end alcoholLevel = value - if not soundLoop then - soundModeLoop() - elseif alcoholLevel <= 0 then + if alcoholLevel <= 0 then soundLoop = false end end) diff --git a/config/client.lua b/config/client.lua index 5ea322d..0166905 100644 --- a/config/client.lua +++ b/config/client.lua @@ -16,16 +16,19 @@ return { [2.0] = { timecycle = 'Drunk', shake = 0.75, + toggleDrunkSounds = true, walk = 'move_m@drunk@moderatedrunk' }, [3.0] = { timecycle = 'spectator5', shake = 1.25, + toggleDrunkSounds = true, walk = 'move_m@drunk@a' }, [4.0] = { timecycle = 'spectator5', shake = 2.0, + toggleDrunkSounds = true, walk = 'MOVE_M@DRUNK@VERYDRUNK' }, },