-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcl.lua
More file actions
79 lines (74 loc) · 2.1 KB
/
cl.lua
File metadata and controls
79 lines (74 loc) · 2.1 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
local isOpen = false
CreateThread(function()
while true do
if NetworkIsPlayerActive(PlayerId()) then
TriggerServerEvent('ev:playerSet')
break
end
Wait(0)
end
end)
local function GameEventTriggered(eventName, data)
if eventName == "CEventNetworkEntityDamage" then
local newbuild = #data == 13
local i = 1
local function iplus()
local x = i
i = i + 1
return x
end
local victim = tonumber(data[iplus()])
local attacker = tonumber(data[iplus()])
iplus()
if newbuild then
iplus()
iplus()
if #data == 12 then i = i - 1 end
end
local victimDied = tonumber(data[iplus()]) == 1 and true or false
if attacker == PlayerPedId() then
if attacker ~= victim then
if IsPedAPlayer(attacker) and IsPedAPlayer(victim) then
if victimDied then
local boneWasDamaged, damagedBone = GetPedLastDamageBone(victim)
if not boneWasDamaged then
damagedBone = -1
end
TriggerServerEvent('ev:updateKillerData', {tostring(GetPlayerServerId(NetworkGetEntityOwner(attacker))), tostring(GetPlayerServerId(NetworkGetEntityOwner(victim))), damagedBone})
end
end
end
end
end
end
AddEventHandler('gameEventTriggered',function(name, args)
GameEventTriggered(name,args)
end)
RegisterNetEvent('ev:showLeaderboard', function(all, result)
if type(result) ~= "table" then
return print('Cannot receive data, sus')
end
isOpen = true
if all then
SetNuiFocus(true, true)
SendNUIMessage({
action = 'showScoreboard',
players = result
})
else
SetNuiFocus(true)
SetNuiFocusKeepInput(true)
SendNUIMessage({
action = 'showScore',
player = result
})
end
end)
RegisterNUICallback('close', function(_, cb)
if isOpen then
SetNuiFocus(false, false)
SetNuiFocusKeepInput(false)
isOpen = false
end
cb({})
end)