feat (player/status): Added isdead check to hunger/thirst check thread

This commit is contained in:
darknight2590
2022-02-16 11:25:53 +02:00
committed by GitHub
parent efd28061e4
commit 430d40db6a
2 changed files with 3 additions and 10 deletions
+2 -2
View File
@@ -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))