Repository navigation
Expand file tree
/
Copy pathserver.lua
More file actions
56 lines (51 loc) · 2.21 KB
/
Copy pathserver.lua
File metadata and controls
56 lines (51 loc) · 2.21 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
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj)
ESX = obj
end)
local dcWebhook =
"https://discord.com/api/webhooks/919536841101824052/TZEDdACjimGAi56KitBVZUsEB1B9pERaceLkM242egNwtBuApBhPwyNupyCyjmuvD8Z6"
ESX.RegisterServerCallback("sky_antiweaponhack:getCleanWeapons", function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
cb(xPlayer.getLoadout())
end)
RegisterServerEvent("sky_antiweaponhack:hackedWeaponDetected")
AddEventHandler("sky_antiweaponhack:hackedWeaponDetected", function(weapon)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
discordLog("Hacked weapon detected",
xPlayer.getName() .. " has cheated a weapon\nIdentifier: " .. xPlayer.getIdentifier())
MySQL.Async.execute("UPDATE users SET antiweaphackban = 1 WHERE identifier = @identifier", {
["@identifier"] = xPlayer.getIdentifier()
})
DropPlayer(_source, "sky_antiweaponhack: You were banned because of a cheated weapon")
end)
RegisterServerEvent("sky_antiweaponhack:checkBan")
AddEventHandler("sky_antiweaponhack:checkBan", function(playerData)
local _source = source
local xPlayer = playerData
MySQL.Async.fetchAll("SELECT antiweaphackban FROM users WHERE identifier = @identifier", {
["@identifier"] = xPlayer.identifier
}, function(result)
if result[1].antiweaphackban then
DropPlayer(_source, "sky_antiweaponhack: You are banned because of a cheated weapon")
end
end)
end)
function discordLog(title, message)
PerformHttpRequest(dcWebhook, function(err, text, headers)
end, 'POST', json.encode({
username = "Sky-Systems",
embeds = {{
["title"] = title,
["color"] = tonumber(0x00afd6),
["description"] = "" .. message .. "",
["footer"] = {
["text"] = "Sky-Systems - " .. os.date("%x %X %p"),
["icon_url"] = "https://cdn.discordapp.com/icons/866631884465373214/9eeb394f36d101b6281d4c64cc8609a4.webp?size=300"
}
}},
avatar_url = "https://cdn.discordapp.com/icons/866631884465373214/9eeb394f36d101b6281d4c64cc8609a4.webp?size=300"
}), {
['Content-Type'] = 'application/json'
})
end