Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: drunk soundMode #7

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading