Files
qb-core-qbcore-fivem/client/loops.lua
T
Atikur Rahaman Santo 07b2107898 is logged in
2021-11-26 19:37:53 +06:00

24 lines
746 B
Lua

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