-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclient.lua
More file actions
211 lines (192 loc) · 5.82 KB
/
Copy pathclient.lua
File metadata and controls
211 lines (192 loc) · 5.82 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
Citizen.CreateThread(function()
local DeathReason, Killer, DeathCauseHash, Weapon
while true do
Citizen.Wait(0)
if IsEntityDead(PlayerPedId()) then
Citizen.Wait(500)
local PedKiller = GetPedSourceOfDeath(PlayerPedId())
DeathCauseHash = GetPedCauseOfDeath(PlayerPedId())
Weapon = WeaponNames[tostring(DeathCauseHash)]
if IsEntityAPed(PedKiller) and IsPedAPlayer(PedKiller) then
Killer = NetworkGetPlayerIndexFromPed(PedKiller)
elseif IsEntityAVehicle(PedKiller) and IsEntityAPed(GetPedInVehicleSeat(PedKiller, -1)) and IsPedAPlayer(GetPedInVehicleSeat(PedKiller, -1)) then
Killer = NetworkGetPlayerIndexFromPed(GetPedInVehicleSeat(PedKiller, -1))
end
if (Killer == PlayerId()) then
DeathReason = 'committed suicide'
elseif (Killer == nil) then
DeathReason = 'died'
else
if IsMelee(DeathCauseHash) then
DeathReason = 'murdered'
elseif IsTorch(DeathCauseHash) then
DeathReason = 'torched'
elseif IsKnife(DeathCauseHash) then
DeathReason = 'knifed'
elseif IsPistol(DeathCauseHash) then
DeathReason = 'pistoled'
elseif IsSub(DeathCauseHash) then
DeathReason = 'riddled'
elseif IsRifle(DeathCauseHash) then
DeathReason = 'rifled'
elseif IsLight(DeathCauseHash) then
DeathReason = 'machine gunned'
elseif IsShotgun(DeathCauseHash) then
DeathReason = 'pulverized'
elseif IsSniper(DeathCauseHash) then
DeathReason = 'sniped'
elseif IsHeavy(DeathCauseHash) then
DeathReason = 'obliterated'
elseif IsMinigun(DeathCauseHash) then
DeathReason = 'shredded'
elseif IsBomb(DeathCauseHash) then
DeathReason = 'bombed'
elseif IsVeh(DeathCauseHash) then
DeathReason = 'mowed over'
elseif IsVK(DeathCauseHash) then
DeathReason = 'flattened'
else
DeathReason = 'killed'
end
end
if DeathReason == 'committed suicide' or DeathReason == 'died' then
TriggerServerEvent('FiveMLogs:playerDied', GetPlayerName(PlayerId()) .. ' ' .. DeathReason .. '.', Weapon)
else
TriggerServerEvent('FiveMLogs:playerDied', GetPlayerName(Killer) .. ' ' .. DeathReason .. ' ' .. GetPlayerName(PlayerId()) .. '.', Weapon)
end
Killer = nil
DeathReason = nil
DeathCauseHash = nil
Weapon = nil
end
while IsEntityDead(PlayerPedId()) do
Citizen.Wait(0)
end
end
end)
function IsMelee(Weapon)
local Weapons = {'WEAPON_UNARMED', 'WEAPON_CROWBAR', 'WEAPON_BAT', 'WEAPON_GOLFCLUB', 'WEAPON_HAMMER', 'WEAPON_NIGHTSTICK'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsTorch(Weapon)
local Weapons = {'WEAPON_MOLOTOV'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsKnife(Weapon)
local Weapons = {'WEAPON_DAGGER', 'WEAPON_KNIFE', 'WEAPON_SWITCHBLADE', 'WEAPON_HATCHET', 'WEAPON_BOTTLE'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsPistol(Weapon)
local Weapons = {'WEAPON_SNSPISTOL', 'WEAPON_HEAVYPISTOL', 'WEAPON_VINTAGEPISTOL', 'WEAPON_PISTOL', 'WEAPON_APPISTOL', 'WEAPON_COMBATPISTOL'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsSub(Weapon)
local Weapons = {'WEAPON_MICROSMG', 'WEAPON_SMG'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsRifle(Weapon)
local Weapons = {'WEAPON_CARBINERIFLE', 'WEAPON_MUSKET', 'WEAPON_ADVANCEDRIFLE', 'WEAPON_ASSAULTRIFLE', 'WEAPON_SPECIALCARBINE', 'WEAPON_COMPACTRIFLE', 'WEAPON_BULLPUPRIFLE'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsLight(Weapon)
local Weapons = {'WEAPON_MG', 'WEAPON_COMBATMG'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsShotgun(Weapon)
local Weapons = {'WEAPON_BULLPUPSHOTGUN', 'WEAPON_ASSAULTSHOTGUN', 'WEAPON_DBSHOTGUN', 'WEAPON_PUMPSHOTGUN', 'WEAPON_HEAVYSHOTGUN', 'WEAPON_SAWNOFFSHOTGUN'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsSniper(Weapon)
local Weapons = {'WEAPON_MARKSMANRIFLE', 'WEAPON_SNIPERRIFLE', 'WEAPON_HEAVYSNIPER', 'WEAPON_ASSAULTSNIPER', 'WEAPON_REMOTESNIPER'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsHeavy(Weapon)
local Weapons = {'WEAPON_GRENADELAUNCHER', 'WEAPON_RPG', 'WEAPON_FLAREGUN', 'WEAPON_HOMINGLAUNCHER', 'WEAPON_FIREWORK', 'VEHICLE_WEAPON_TANK'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsMinigun(Weapon)
local Weapons = {'WEAPON_MINIGUN'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsBomb(Weapon)
local Weapons = {'WEAPON_GRENADE', 'WEAPON_PROXMINE', 'WEAPON_EXPLOSION', 'WEAPON_STICKYBOMB'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsVeh(Weapon)
local Weapons = {'VEHICLE_WEAPON_ROTORS'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end
function IsVK(Weapon)
local Weapons = {'WEAPON_RUN_OVER_BY_CAR', 'WEAPON_RAMMED_BY_CAR'}
for i, CurrentWeapon in ipairs(Weapons) do
if GetHashKey(CurrentWeapon) == Weapon then
return true
end
end
return false
end