From da7d7b454ab3a5211afa7ae83a20ed3f805751c0 Mon Sep 17 00:00:00 2001 From: Popcorn RP - PrinceAlbert <85725579+alberttheprince@users.noreply.github.com> Date: Tue, 7 Nov 2023 03:58:51 -0500 Subject: [PATCH 1/6] Update main.lua --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index de0b72f..531a627 100644 --- a/client/main.lua +++ b/client/main.lua @@ -275,7 +275,7 @@ end) RegisterNetEvent("qb-diving:client:setoxygenlevel", function() if oxygenLevel == 0 then - oxygenLevel = 100 -- oxygenlevel + oxygenLevel = Config.OxygenLevel -- oxygenlevel exports.qbx_core:Notify(Lang:t("success.tube_filled"), 'success') TriggerServerEvent('qb-diving:server:removeItemAfterFill') return From 91ecf521a84a5d16a8eb7d3b3b809044bcbb7214 Mon Sep 17 00:00:00 2001 From: Popcorn RP - PrinceAlbert <85725579+alberttheprince@users.noreply.github.com> Date: Tue, 7 Nov 2023 03:59:35 -0500 Subject: [PATCH 2/6] Update config.lua --- config.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/config.lua b/config.lua index 4bcbc64..7ea7373 100644 --- a/config.lua +++ b/config.lua @@ -1,6 +1,7 @@ Config = Config or {} Config.UseTarget = GetConvar('UseTarget', 'false') == 'true' -- Use qb-target interactions (don't change this, go to your server.cfg and add `setr UseTarget true` to use this and just that from true to false or the other way around) Config.CopsChance = 0.5 -- The chance of the cops getting called when a coral gets picked up, this ranges from 0.0 to 1.0 +Config.OxygenLevel = 100 Config.CoralLocations = { [1] = { label = "This is Location 1", From 10faf5d51bbf9eb7a2267fec09d1ef6ac92e0b57 Mon Sep 17 00:00:00 2001 From: Popcorn RP - PrinceAlbert <85725579+alberttheprince@users.noreply.github.com> Date: Tue, 7 Nov 2023 04:36:04 -0500 Subject: [PATCH 3/6] Update config.lua --- config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.lua b/config.lua index 7ea7373..373efc7 100644 --- a/config.lua +++ b/config.lua @@ -1,7 +1,7 @@ Config = Config or {} Config.UseTarget = GetConvar('UseTarget', 'false') == 'true' -- Use qb-target interactions (don't change this, go to your server.cfg and add `setr UseTarget true` to use this and just that from true to false or the other way around) Config.CopsChance = 0.5 -- The chance of the cops getting called when a coral gets picked up, this ranges from 0.0 to 1.0 -Config.OxygenLevel = 100 +Config.OxygenLevel = 100 -- in seconds Config.CoralLocations = { [1] = { label = "This is Location 1", From 3dcf31ab66d8a77dbe6bb92e8595b255fc4e6544 Mon Sep 17 00:00:00 2001 From: Popcorn RP - PrinceAlbert <85725579+alberttheprince@users.noreply.github.com> Date: Tue, 7 Nov 2023 04:37:12 -0500 Subject: [PATCH 4/6] Update main.lua replaced 100 with Config.OxygenLevel --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 531a627..0fd3e8d 100644 --- a/client/main.lua +++ b/client/main.lua @@ -350,7 +350,7 @@ RegisterNetEvent('qb-diving:client:UseGear', function() CreateThread(function() while currentGear.enabled and IsPedSwimmingUnderWater(cache.ped) do oxygenLevel -= 1 - if oxygenLevel % 10 == 0 and oxygenLevel ~= 100 then + if oxygenLevel % 10 == 0 and oxygenLevel ~= Config.OxygenLevel then TriggerServerEvent("InteractSound_SV:PlayOnSource", "breathdivingsuit", 0.25) elseif oxygenLevel == 0 then SetEnableScuba(cache.ped, false) From dd7a113598cc1c5e68c7ab285e111acea25abc05 Mon Sep 17 00:00:00 2001 From: Popcorn RP - PrinceAlbert <85725579+alberttheprince@users.noreply.github.com> Date: Tue, 7 Nov 2023 05:54:26 -0500 Subject: [PATCH 5/6] Update client/main.lua Co-authored-by: Tony <97451137+TonybynMp4@users.noreply.github.com> --- client/main.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 0fd3e8d..3fd5bd8 100644 --- a/client/main.lua +++ b/client/main.lua @@ -348,7 +348,12 @@ RegisterNetEvent('qb-diving:client:UseGear', function() currentGear.enabled = true TriggerServerEvent("InteractSound_SV:PlayOnSource", "breathdivingsuit", 0.25) CreateThread(function() - while currentGear.enabled and IsPedSwimmingUnderWater(cache.ped) do + while currentGear.enabled and oxygenLevel > 0 do + oxygenLevel -= 1 + if oxygenLevel % 10 == 0 and oxygenLevel ~= Config.OxygenLevel then + TriggerServerEvent("InteractSound_SV:PlayOnSource", "breathdivingsuit", 0.25) + end + if oxygenLevel == 0 then oxygenLevel -= 1 if oxygenLevel % 10 == 0 and oxygenLevel ~= Config.OxygenLevel then TriggerServerEvent("InteractSound_SV:PlayOnSource", "breathdivingsuit", 0.25) From 3c8d863d88efc8f5f578ea41f5a29abe0e4aa088 Mon Sep 17 00:00:00 2001 From: Manason Date: Tue, 7 Nov 2023 06:44:06 -0800 Subject: [PATCH 6/6] oxygen level won't go lower than 0 --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index f70871d..749d15b 100644 --- a/client/main.lua +++ b/client/main.lua @@ -349,7 +349,7 @@ RegisterNetEvent('qb-diving:client:UseGear', function() TriggerServerEvent("InteractSound_SV:PlayOnSource", "breathdivingsuit", 0.25) CreateThread(function() while currentGear.enabled do - if oxygenLevel > 0 then + if IsPedSwimmingUnderWater(cache.ped) and oxygenLevel > 0 then oxygenLevel -= 1 if oxygenLevel % 10 == 0 and oxygenLevel ~= Config.OxygenLevel then TriggerServerEvent("InteractSound_SV:PlayOnSource", "breathdivingsuit", 0.25)