Compare commits

...

2 Commits

Author SHA1 Message Date
Jim Shield
45f390c177 Update playerfunctions.lua 2025-10-04 22:10:39 +01:00
Jim Shield
803c612cbb Change stress to take away instead of increase 2025-10-04 19:12:50 +01:00

View File

@@ -32,7 +32,7 @@ local hungerThirstFunc = {
setStress =
function(src, stress)
local Player = Core.Functions.GetPlayer(src)
local newStress = Player.PlayerData.metadata.stress + stress
local newStress = Player.PlayerData.metadata.stress - stress
newStress = (newStress >= 100.0 and 100.0)or (newStress <= 0 and 0) or newStress
Player.Functions.SetMetaData('stress', newStress)
TriggerClientEvent('hud:client:UpdateStress', src, newStress)
@@ -59,7 +59,7 @@ local hungerThirstFunc = {
setStress =
function(src, stress)
local Player = Core.Functions.GetPlayer(src)
local newStress = Player.PlayerData.metadata.stress + stress
local newStress = Player.PlayerData.metadata.stress - stress
newStress = (newStress >= 100.0 and 100.0)or (newStress <= 0 and 0) or newStress
Player.Functions.SetMetaData('stress', newStress)
TriggerClientEvent('hud:client:UpdateStress', src, newStress)
@@ -86,7 +86,7 @@ local hungerThirstFunc = {
setStress =
function(src, stress)
local Player = Core.Functions.GetPlayer(src)
local newStress = Player.PlayerData.metadata.stress + stress
local newStress = Player.PlayerData.metadata.stress - stress
newStress = (newStress >= 100.0 and 100.0) or (newStress <= 0 and 0) or newStress
Player.Functions.SetMetaData('stress', newStress)
TriggerClientEvent('hud:client:UpdateStress', src, newStress)
@@ -187,10 +187,10 @@ end)
--- Server event handler for setting player needs (thirst or hunger).
---
--- @event
--- @param type string "thirst" or "hunger".
--- @param needType string "thirst" or "hunger".
--- @param amount number New value to set.
RegisterNetEvent(getScript()..":server:setNeed", function(needType, amount)
print("^1Deprecated function ':server:setNeed' called, please update your scripts^7")
print("^1Deprecated function ':server:setNeed' called, please update the scripts that use it^7")
-- local src = source
-- if needType == "thirst" then
-- setThirst(src, amount)