-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclient.lua
More file actions
39 lines (27 loc) · 943 Bytes
/
client.lua
File metadata and controls
39 lines (27 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
local previousHealth = GetEntityHealth(GetPlayerPed(-1))
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
health = GetEntityHealth(GetPlayerPed(-1))
if(health ~= previousHealth) then
TriggerServerEvent('syncpos:sync', GetEntityCoords(GetPlayerPed(-1)))
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait((15) * 1000)
TriggerServerEvent('syncpos:sync', GetEntityCoords(GetPlayerPed(-1)))
end
end)
RegisterCommand('savepos', function(source, args, raw)
TriggerServerEvent('syncpos:manualSave')
end)
RegisterNetEvent('syncpos:clientspawn')
AddEventHandler('syncpos:spawn', function(x, y, z)
SetEntityCoords(GetPlayerPed(-1), x, y, z, 1, 0, 0, 1)
end)
RegisterNetEvent('playerSpawned')
AddEventHandler('playerSpawned', function()
TriggerServerEvent('syncpos:spawn')
end)