Files
qb-core-qbcore-fivem/client/loops.lua
T
TheiLLeniumStudios db11c7dcec Fix linting issues
2022-05-04 08:08:29 +00:00

25 lines
831 B
Lua

CreateThread(function()
while true do
local sleep = 0
if LocalPlayer.state.isLoggedIn then
sleep = (1000 * 60) * QBCore.Config.UpdateInterval
TriggerServerEvent('QBCore:UpdatePlayer')
end
Wait(sleep)
end
end)
CreateThread(function()
while true do
if LocalPlayer.state.isLoggedIn then
if (QBCore.PlayerData.metadata['hunger'] <= 0 or QBCore.PlayerData.metadata['thirst'] <= 0) and not QBCore.PlayerData.metadata['isdead'] then
local ped = PlayerPedId()
local currentHealth = GetEntityHealth(ped)
local decreaseTreshold = math.random(5, 10)
SetEntityHealth(ped, currentHealth - decreaseTreshold)
end
end
Wait(QBCore.Config.StatusInterval)
end
end)