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))
+1 -8
View File
@@ -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