fix(client): config options and interact sound (#7)

This commit is contained in:
Matthew
2023-12-24 15:57:00 +01:00
committed by GitHub
parent 7d809f99a8
commit 60dd3a9851
2 changed files with 8 additions and 9 deletions
+7 -8
View File
@@ -25,7 +25,7 @@ lib.callback.register('qbx_divegear:client:fillTank', function()
end end
if lib.progressBar({ if lib.progressBar({
duration = config.RefillTankTimeMs, duration = config.refillTankTimeMs,
label = Lang:t('info.filling_air'), label = Lang:t('info.filling_air'),
useWhileDead = false, useWhileDead = false,
canCancel = true, canCancel = true,
@@ -35,7 +35,6 @@ lib.callback.register('qbx_divegear:client:fillTank', function()
blendIn = 8.0 blendIn = 8.0
} }
}) then }) then
oxygenLevel = config.startingOxygenLevel oxygenLevel = config.startingOxygenLevel
exports.qbx_core:Notify(Lang:t('success.tube_filled'), 'success') exports.qbx_core:Notify(Lang:t('success.tube_filled'), 'success')
if currentGear.enabled then if currentGear.enabled then
@@ -76,7 +75,7 @@ end
local function takeOffSuit() local function takeOffSuit()
if lib.progressBar({ if lib.progressBar({
duration = config.TakeOffSuitTimeMs, duration = config.takeOffSuitTimeMs,
label = Lang:t('info.pullout_suit'), label = Lang:t('info.pullout_suit'),
useWhileDead = false, useWhileDead = false,
canCancel = true, canCancel = true,
@@ -91,7 +90,7 @@ local function takeOffSuit()
currentGear.enabled = false currentGear.enabled = false
deleteGear() deleteGear()
exports.qbx_core:Notify(Lang:t('success.took_out')) exports.qbx_core:Notify(Lang:t('success.took_out'))
TriggerServerEvent('InteractSound_SV:PlayOnSource', nil, 0.25) -- Stop breathing suit audio
end end
end end
@@ -112,11 +111,11 @@ local function startOxygenLevelDecrementerThread()
if IsPedSwimmingUnderWater(cache.ped) and oxygenLevel > 0 then if IsPedSwimmingUnderWater(cache.ped) and oxygenLevel > 0 then
oxygenLevel -= 1 oxygenLevel -= 1
if oxygenLevel % 10 == 0 and oxygenLevel ~= config.startingOxygenLevel then if oxygenLevel % 10 == 0 and oxygenLevel ~= config.startingOxygenLevel then
TriggerServerEvent('InteractSound_SV:PlayOnSource', 'breathdivingsuit', 0.25) -- Initiate breathing suit audio
end end
if oxygenLevel == 0 then if oxygenLevel == 0 then
disableScuba() disableScuba()
TriggerServerEvent('InteractSound_SV:PlayOnSource', nil, 0.25) -- Stop breathing suit audio
end end
end end
Wait(1000) Wait(1000)
@@ -136,7 +135,7 @@ local function putOnSuit()
end end
if lib.progressBar({ if lib.progressBar({
duration = config.PutOnSuitTimeMs, duration = config.putOnSuitTimeMs,
label = Lang:t('info.put_suit'), label = Lang:t('info.put_suit'),
useWhileDead = false, useWhileDead = false,
canCancel = true, canCancel = true,
@@ -150,7 +149,7 @@ local function putOnSuit()
attachGear() attachGear()
enableScuba() enableScuba()
currentGear.enabled = true currentGear.enabled = true
TriggerServerEvent('InteractSound_SV:PlayOnSource', 'breathdivingsuit', 0.25) -- Initiate breathing suit audio
startOxygenLevelDecrementerThread() startOxygenLevelDecrementerThread()
startOxygenLevelDrawTextThread() startOxygenLevelDrawTextThread()
end end
+1 -1
View File
@@ -2,5 +2,5 @@ return {
startingOxygenLevel = 100, startingOxygenLevel = 100,
putOnSuitTimeMs = 5000, putOnSuitTimeMs = 5000,
takeOffSuitTimeMs = 5000, takeOffSuitTimeMs = 5000,
RefillTankTimeMs = 5000 refillTankTimeMs = 5000
} }