From 72b497346051f71108d3ea858689604a3e485d7b Mon Sep 17 00:00:00 2001 From: Antony <97451137+TonybynMp4@users.noreply.github.com> Date: Fri, 24 May 2024 00:09:44 +0200 Subject: [PATCH] feat: drunk soundMode (#7) * feat: drunk soundMode * increment version --- client/main.lua | 18 ++++++++++++++++++ config/client.lua | 2 ++ fxmanifest.lua | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) 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 = { 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',