bring in loops, will change

This commit is contained in:
Kakarot
2025-03-11 23:35:12 -05:00
parent 493d5b7279
commit a08a950e73
+34
View File
@@ -0,0 +1,34 @@
-- CreateThread(function()
-- while not NetworkIsSessionStarted() do Wait(500) end
-- print('player has loaded at this point')
-- end)
CreateThread(function()
while true do
local sleep = 1000
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 (LocalPlayer.state['metadata:hunger'] <= 0 or LocalPlayer.state['metadata:thirst'] <= 0)
and not (LocalPlayer.state['metadata:isdead'] or LocalPlayer.state['metadata:inlaststand']) then
local ped = PlayerPedId()
local currentHealth = GetEntityHealth(ped)
local decreaseThreshold = math.random(5, 10)
if currentHealth - decreaseThreshold > 0 then
SetEntityHealth(ped, currentHealth - decreaseThreshold)
else
SetEntityHealth(ped, 0)
end
end
end
Wait(QBCore.Config.StatusInterval)
end
end)