Skip to content

Commit

Permalink
feat: drunk soundMode (#7)
Browse files Browse the repository at this point in the history
* feat: drunk soundMode

* increment version
  • Loading branch information
TonybynMp4 committed May 23, 2024
1 parent 257ae16 commit 72b4973
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
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
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 72b4973

Please sign in to comment.