From d7a8a204910f7a81e7e9ae4898a602e1d839ac11 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Fri, 10 Oct 2025 01:57:01 +0100 Subject: [PATCH] Make GenerateRandomValues() return 0 Its possible if no health, thirst or stress was set, it may sent back an empty table, which would then break the finish consume function in the server --- shared/shared.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shared/shared.lua b/shared/shared.lua index 159c57c..3aebd6f 100644 --- a/shared/shared.lua +++ b/shared/shared.lua @@ -15,6 +15,7 @@ function GenerateRandomValues(data) transData[k] = v end end + if transData.hunger > 0 then transData.hunger = transData.hunger > 100 and 100 or transData.hunger end @@ -26,12 +27,13 @@ function GenerateRandomValues(data) if transData.stress > 0 then transData.stress = transData.stress > 100 and 100 or transData.stress end + return transData["time"], transData["heal"], transData["armor"], { - hunger = transData["hunger"], - thirst = transData["thirst"], - stress = transData["stress"] + hunger = transData["hunger"] or 0, + thirst = transData["thirst"] or 0, + stress = transData["stress"] or 0 } end \ No newline at end of file