File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- CreateThread(function()
2
+ -- while not NetworkIsSessionStarted() do Wait(500) end
3
+ -- print('player has loaded at this point')
4
+ -- end)
5
+
6
+ CreateThread (function ()
7
+ while true do
8
+ local sleep = 1000
9
+ if LocalPlayer .state .isLoggedIn then
10
+ sleep = (1000 * 60 ) * QBCore .Config .UpdateInterval
11
+ TriggerServerEvent (' QBCore:UpdatePlayer' )
12
+ end
13
+ Wait (sleep )
14
+ end
15
+ end )
16
+
17
+ CreateThread (function ()
18
+ while true do
19
+ if LocalPlayer .state .isLoggedIn then
20
+ if (LocalPlayer .state [' metadata:hunger' ] <= 0 or LocalPlayer .state [' metadata:thirst' ] <= 0 )
21
+ and not (LocalPlayer .state [' metadata:isdead' ] or LocalPlayer .state [' metadata:inlaststand' ]) then
22
+ local ped = PlayerPedId ()
23
+ local currentHealth = GetEntityHealth (ped )
24
+ local decreaseThreshold = math.random (5 , 10 )
25
+ if currentHealth - decreaseThreshold > 0 then
26
+ SetEntityHealth (ped , currentHealth - decreaseThreshold )
27
+ else
28
+ SetEntityHealth (ped , 0 )
29
+ end
30
+ end
31
+ end
32
+ Wait (QBCore .Config .StatusInterval )
33
+ end
34
+ end )
You can’t perform that action at this time.
0 commit comments