Skip to content

Commit

Permalink
feat: Config option to set max oxygen level
Browse files Browse the repository at this point in the history
* Update main.lua

* Update config.lua

* Update config.lua

* Update main.lua

replaced 100 with Config.OxygenLevel

* Update client/main.lua

Co-authored-by: Tony <[email protected]>

* oxygen level won't go lower than 0

---------

Co-authored-by: Tony <[email protected]>
Co-authored-by: Manason <[email protected]>
  • Loading branch information
3 people authored Nov 7, 2023
1 parent f43241a commit 9665f0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -349,9 +349,9 @@ RegisterNetEvent('qb-diving:client:UseGear', function()
TriggerServerEvent("InteractSound_SV:PlayOnSource", "breathdivingsuit", 0.25)
CreateThread(function()
while currentGear.enabled do
if IsPedSwimmingUnderWater(cache.ped) then
if IsPedSwimmingUnderWater(cache.ped) and oxygenLevel > 0 then
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)
Expand Down
1 change: 1 addition & 0 deletions config.lua
Original file line number Diff line number Diff line change
@@ -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 -- in seconds
Config.CoralLocations = {
[1] = {
label = "This is Location 1",
Expand Down

0 comments on commit 9665f0c

Please sign in to comment.