diff --git a/client/stress.lua b/client/stress.lua index 73e6735..3d49c37 100644 --- a/client/stress.lua +++ b/client/stress.lua @@ -68,7 +68,8 @@ CreateThread(function() TriggerScreenblurFadeOut(1000.0) if not cache.vehicle and not IsPedRagdoll(cache.ped) and IsPedOnFoot(cache.ped) and not IsPedSwimming(cache.ped) then - SetPedToRagdollWithFall(cache.ped, RagdollTimeout, RagdollTimeout, 1, GetEntityForwardVector(cache.ped), 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) + local forwardVec3 = GetEntityForwardVector(cache.ped) + SetPedToRagdollWithFall(cache.ped, RagdollTimeout, RagdollTimeout, 1, forwardVec3.x, forwardVec3.y, forwardVec3.z, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) end Wait(1000) diff --git a/client/vehicle.lua b/client/vehicle.lua index b2dce30..7781321 100644 --- a/client/vehicle.lua +++ b/client/vehicle.lua @@ -109,9 +109,10 @@ local function vehiclehudloop() } + -- not ideal, the 1500 doesn't actually equal 150 seconds because of framerate if config.lowFuelAlert and getVehicleFuelLevel(cache.vehicle) < config.lowFuelAlert then if alert > 0 then - alert = alert - 1 + alert -= 1 else alert = 1500 qbx.playAudio({ diff --git a/server/stress.lua b/server/stress.lua index 1c95132..c51db0e 100644 --- a/server/stress.lua +++ b/server/stress.lua @@ -1,25 +1,26 @@ local config = require 'config.server' -RegisterNetEvent('hud:server:GainStress', function(amount) +local function alterStress(source, amount) local playerState = Player(source).state local player = exports.qbx_core:GetPlayer(source) - if not player or (config.disablePoliceStress and player.PlayerData.job.type == 'leo') then return end + if not player or (amount > 0 and config.disablePoliceStress and player.PlayerData.job.type == 'leo') then return end local newStress = playerState.stress + amount newStress = lib.math.clamp(newStress, 0, 100) playerState:set("stress", newStress, true) - exports.qbx_core:Notify(source, locale("notify.stress_gain"), 'inform', 2500, nil, nil, {'#141517', '#ffffff'}, 'brain', '#C53030') -end) -RegisterNetEvent('hud:server:RelieveStress', function(amount) - local playerState = Player(source).state - local player = exports.qbx_core:GetPlayer(source) - if not player then return end + if amount > 0 then + exports.qbx_core:Notify(source, locale("notify.stress_gain"), 'inform', 2500, nil, nil, {'#141517', '#ffffff'}, 'brain', '#C53030') + else + exports.qbx_core:Notify(source, locale("notify.stress_removed"), 'inform', 2500, nil, nil, {'#141517', '#ffffff'}, 'brain', '#0F52BA') + end +end - local newStress = playerState.stress - amount - newStress = lib.math.clamp(newStress, 0, 100) +RegisterNetEvent('hud:server:GainStress', function(amount) + alterStress(source, amount) +end) - playerState:set("stress", newStress, true) - exports.qbx_core:Notify(source, locale("notify.stress_removed"), 'inform', 2500, nil, nil, {'#141517', '#ffffff'}, 'brain', '#0F52BA') +RegisterNetEvent('hud:server:RelieveStress', function(amount) + alterStress(source, -amount) end) \ No newline at end of file