-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
69 lines (59 loc) · 1.73 KB
/
client.lua
File metadata and controls
69 lines (59 loc) · 1.73 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
ESX = exports["es_extended"]:getSharedObject()
local isDead = false
local isReviving = false
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerData = xPlayer
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
ESX.PlayerData.job = job
end)
RegisterCommand('medico', function()
if not isDead then
ESX.ShowNotification('Puoi usare questo comando solo quando sei morto!')
return
end
if isReviving then
ESX.ShowNotification('Stai già ricevendo cure mediche!')
return
end
TriggerServerEvent('ardenhub_medico:checkMoney')
end)
RegisterNetEvent('ardenhub_medico:startRevive')
AddEventHandler('ardenhub_medico:startRevive', function()
isReviving = true
if exports['ox_lib']:progressCircle({
duration = Config.RianimazioneTimer * 1000,
label = 'Rianimazione in corso...',
position = 'bottom',
useWhileDead = true,
canCancel = false,
disable = {
move = true,
car = true,
combat = true,
mouse = false
},
anim = {
dict = 'mini@cpr@char_a@cpr_str',
clip = 'cpr_pumpchest',
flag = 49,
blendIn = 3.0,
blendOut = 1.0,
playbackRate = 0
},
}) then
TriggerEvent('esx_ambulancejob:revive')
end
isReviving = false
end)
Citizen.CreateThread(function()
while true do
Wait(500)
if NetworkIsPlayerActive(PlayerId()) then
local playerPed = PlayerPedId()
isDead = IsEntityDead(playerPed)
end
end
end)