mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 09:01:26 +00:00
24 lines
746 B
Lua
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)
|