From 430d40db6ae1480bab3bd07858d55a2037e642d4 Mon Sep 17 00:00:00 2001 From: darknight2590 <87971656+darknight2590@users.noreply.github.com> Date: Wed, 16 Feb 2022 11:25:53 +0200 Subject: [PATCH] feat (player/status): Added isdead check to hunger/thirst check thread --- client/loops.lua | 4 ++-- config.lua | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/client/loops.lua b/client/loops.lua index ad79218..970ae84 100644 --- a/client/loops.lua +++ b/client/loops.lua @@ -11,9 +11,9 @@ end) CreateThread(function() while true do Wait(QBCore.Config.StatusInterval) + local PlayerData = QBCore.Functions.GetPlayerData() if LocalPlayer.state.isLoggedIn then - if QBCore.Functions.GetPlayerData().metadata['hunger'] <= 0 or - QBCore.Functions.GetPlayerData().metadata['thirst'] <= 0 then + if (PlayerData.metadata['hunger'] <= 0 or PlayerData.metadata['thirst'] <= 0) and (not PlayerData.metadata['isdead']) then local ped = PlayerPedId() local currentHealth = GetEntityHealth(ped) SetEntityHealth(ped, currentHealth - math.random(5, 10)) diff --git a/config.lua b/config.lua index 35a025a..65c8681 100644 --- a/config.lua +++ b/config.lua @@ -17,14 +17,7 @@ QBConfig.Player.MaxInvSlots = 41 -- Max inventory slots for a player QBConfig.Player.HungerRate = 4.2 -- Rate at which hunger goes down. QBConfig.Player.ThirstRate = 3.8 -- Rate at which thirst goes down. QBConfig.Player.Bloodtypes = { - "A+", - "A-", - "B+", - "B-", - "AB+", - "AB-", - "O+", - "O-", + "A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-", } QBConfig.Server = {} -- General server config