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:
1 parent
8bf02f6372
commit
08c3d937d6
1 file changed
+2
-2
@@ -234,7 +234,7 @@ Framework.GetHunger = function(src)
|
|||||||
if not player then return end
|
if not player then return end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newHunger = (playerData.metadata.hunger or 0)
|
local newHunger = (playerData.metadata.hunger or 0)
|
||||||
return newHunger
|
return math.floor((newHunger) + 0.5) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return a boolean if the player is dead or in last stand.
|
---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
|
if not player then return end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newThirst = (playerData.metadata.thirst or 0)
|
local newThirst = (playerData.metadata.thirst or 0)
|
||||||
return newThirst
|
return math.floor((newThirst) + 0.5) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the phone number of the player.
|
---Returns the phone number of the player.
|
||||||
|
|||||||
Reference in new issue
Block a user