mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
easier file management
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(7)
|
||||
if NetworkIsSessionStarted() then
|
||||
Citizen.Wait(10)
|
||||
TriggerServerEvent('QBCore:PlayerJoined')
|
||||
return
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(7)
|
||||
if isLoggedIn then
|
||||
Citizen.Wait((1000 * 60) * 10)
|
||||
TriggerEvent("QBCore:Player:UpdatePlayerData")
|
||||
else
|
||||
Citizen.Wait(5000)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(7)
|
||||
if isLoggedIn then
|
||||
Citizen.Wait(30000)
|
||||
TriggerEvent("QBCore:Player:UpdatePlayerPosition")
|
||||
else
|
||||
Citizen.Wait(5000)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(math.random(3000, 5000))
|
||||
if 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)
|
||||
Reference in New Issue
Block a user