Round hunger and thirst values to nearest integer

Updated GetHunger and GetThirst functions to return rounded integer values using math.floor(value + 0.5) for consistency and to avoid floating point results.
This commit is contained in:
MrNewb committed 2025-09-10 11:29:42 -04:00
1 parent 8bf02f6372
commit 08c3d937d6
1 file changed
+2 -2
+2 -2
View File
@@ -234,7 +234,7 @@ Framework.GetHunger = function(src)
if not player then return end
local playerData = player.PlayerData
local newHunger = (playerData.metadata.hunger or 0)
return newHunger
return math.floor((newHunger) + 0.5) or 0
end
---This will return a boolean if the player is dead or in last stand.
@@ -265,7 +265,7 @@ Framework.GetThirst = function(src)
if not player then return end
local playerData = player.PlayerData
local newThirst = (playerData.metadata.thirst or 0)
return newThirst
return math.floor((newThirst) + 0.5) or 0
end
---Returns the phone number of the player.