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

Adding Oxygen level config option #7

Merged
merged 7 commits into from
Nov 7, 2023
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
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
Loading