-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathclient.lua
More file actions
193 lines (154 loc) · 4.67 KB
/
Copy pathclient.lua
File metadata and controls
193 lines (154 loc) · 4.67 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
local health
local multi
local pulse = 70
local area = "Unknown"
local lastHit
local blood = 100
local bleeding = 0
local dead = false
local timer = 0
local cPulse = -1
local cBlood = -1
local cNameF = ""
local cNameL = ""
local cArea = ""
local cBleeding = "NONE"
RegisterCommand('getpulse', function(source, args)
local health = GetEntityHealth(GetPlayerPed(-1))
if health > 0 then
pulse = (health / 4 + math.random(19, 28))
end
print(pulse)
local hit, bone = GetPedLastDamageBone(GetPlayerPed(-1))
print(bone)
end, false)
AddEventHandler('esx:onPlayerDeath', function(data)
multi = 2.0
blood = 100
health = GetEntityHealth(GetPlayerPed(-1))
area = "LEGS/ARMS"
local hit, bone = GetPedLastDamageBone(GetPlayerPed(-1))
bleeding = 1
if (bone == 31086) then
multi = 0.0
print('HEADSHOT')
TriggerEvent('chatMessage', "MedSystem", {255, 0, 0}, "You have been shot/damaged in HEAD area")
bleeding = 5
area = "HEAD"
end
if bone == 24817 or bone == 24818 or bone == 10706 or bone == 24816 or bone == 11816 then
multi = 1.0
print('BODYSHOT')
TriggerEvent('chatMessage', "MedSystem", {255, 0, 0}, "You have been shot/damaged in BODY area")
bleeding = 2
area = "BODY"
end
pulse = ((health / 4 + 20) * multi) + math.random(0, 4)
dead = true
end)
Citizen.CreateThread( function()
while true do
Wait(5000)
local hp = GetEntityHealth(GetPlayerPed(-1))
if hp >= 1 and dead then
dead = false
bleeding = 0
blood = 100
end
if dead and blood > 0 then
blood = blood - bleeding
end
end
end)
function DrawAdvancedText(x,y ,w,h,sc, text, r,g,b,a,font,jus)
SetTextFont(font)
SetTextProportional(0)
SetTextScale(sc, sc)
N_0x4e096588b13ffeca(jus)
SetTextColour(r, g, b, a)
SetTextDropShadow(0, 0, 0, 0,100)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x - 0.1+w, y - 0.02+h)
end
RegisterNetEvent('medSystem:near')
AddEventHandler('medSystem:near', function(x,y,z, pulse, blood, nameF, nameL, area, bldn)
-- ESX.ShowNotification( nameF..' '..nameL..area , true , true, 30) --- client
local md = Config.Declared
if area == "HEAD" and blood<=5 then
--if area ~= nil then
cBlood = blood
cPulse = pulse
cNameF = nameF
cNameL = nameL
cArea = area
ESX.ShowNotification( nameF..' '..nameL..' '..Config.Declared , true , true, 20) --- client
message = nameF..' '..nameL..' '..Config.Declared
TriggerEvent('chat:addMessage', {
template = '<div class="chat-message ems"><b>Medical Center </b>: <b>'..message..'</b></div>',
args = { -1, message }
})
-- TriggerEvent('chatMessage', "Eastbound Medical: ", {255,0 , 0}, "^1 "..message..!")
end
local a,b,c = GetEntityCoords(GetPlayerPed(-1))
if GetDistanceBetweenCoords(x,y,z,a,b,c,false) < 10 then
timer = Config.Timer
--ESX.ShowNotification( "MedSystem: [0-5] DEAD | [5-15] Needs hospital | [15-38] EMS Can help | [38-55] Police can help | [55+] Healthy", false,true,30)
cBlood = blood
cPulse = pulse
cNameF = nameF
cNameL = nameL
cArea = area
if bldn == 1 then
cBleeding = "SLOW"
elseif bldn == 2 then
cBleeding "MEDIUM"
elseif bldn == 5 then
cBleeding = "FAST"
elseif bldn == 0 then
cBleeding = "NONE"
end
-- TriggerEvent('chatMessage', "Eastbound Medical", {255,0 , 0}, cNameF.." "..cNameL.."^1 DECLARED DEAD. ^6 PLEASE RESPAWN.!")
else
timer = 0
cBlood = -1
cPulse = -1
cNameF = ""
cNameL = ""
cArea = ""
cBleeding = "SLOW"
end
end)
Citizen.CreateThread( function()
while true do
Wait(1)
while timer >= 1 do
Wait(1)
if cPulse ~= -1 and cBlood ~= -1 then
DrawAdvancedText(0.7, 0.7, 0.005, 0.0028, 0.9, cNameF .. " " .. cNameL .. "\n~r~Pulse: ~w~" .. cPulse .. "BPM\n~r~Blood: ~w~" .. cBlood .. "%~r~\nHurt area: ~w~" .. cArea .. "\n~r~Bleeding: ~w~" .. cBleeding, 255, 255, 255, 255, 4, 1)
end
end
end
end)
Citizen.CreateThread( function()
while true do
Wait(1000)
if timer >= 1 then
timer = timer - 1
end
end
end)
RegisterNetEvent('medSystem:send')
AddEventHandler('medSystem:send', function(req)
local health = GetEntityHealth(GetPlayerPed(-1))
if health > 0 then
pulse = (health / 4 + math.random(19, 28))
end
local a, b, c = table.unpack(GetEntityCoords(GetPlayerPed(-1)))
TriggerServerEvent('medSystem:print', req, math.floor(pulse * (blood / 90)), area, blood, a, b, c, bleeding)
end)