forked from Citizen01/mdayz-anticheat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanticheat_s.lua
77 lines (69 loc) · 2.35 KB
/
anticheat_s.lua
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
-- Settings
maxHealth = 12000
maxFood = 100
maxThirst = 100
maxSlots = 80 -- You must put the number of slots of the best backpack of your server
addEventHandler("onElementDataChange",getRootElement(),
function(data)
if getElementType(source) == "player" then
if data == "blood" then
checkHealth(source)
elseif data == "food" then
checkFood(source)
elseif data == "thirst" then
checkThirst(source)
elseif data == "MAX_Slots" then
checkSlots(source)
else
end
end
end)
function checkHealth(source)
local vHealth = getElementData(source, "blood") or 0
if vHealth > maxHealth then
setElementData(source, "blood", 12000)
kickPlayer(source, "[AC] : Health Hack")
end
end
function checkFood(source)
local vFood = getElementData(source, "food") or 0
if vFood > maxFood then
setElementData(source, "food", 30)
kickPlayer(source, "[AC] : Food Hack")
end
end
function checkThirst(source)
local vThirst = getElementData(source, "thirst") or 0
if vThirst > maxThirst then
setElementData(source, "thirst", 30)
kickPlayer(source, "[AC] : Thirst Hack")
end
end
function checkSlots(source)
local vSlots = getElementData(source, "MAX_Slots") or 0
if vSlots > maxSlots then
setElementData(source, "MAX_Slots", 0)
kickPlayer(source, "[AC] : Slots Hack")
end
end
function detectVehicleCheat(vehicle, seat, jacked)
if ( getElementModel(vehicle) == 432 or getElementModel(vehicle) == 425 or getElementModel(vehicle) == 501 or getElementModel(vehicle) == 564 or getElementModel(Vehicle) == 594 or getElementModel(vehicle) == 601 or getElementModel(vehicle) == 447 or getElementModel(vehicle) == 520 ) then
if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(source)), aclGetGroup ( "Everyone" ) ) then
kickPlayer(source, "[AC] : Vehicle Hack")
end
end
end
addEventHandler("onPlayerVehicleEnter", getRootElement(), detectVehicleCheat)
WeaponID = {
[35] = true,
[36] = true,
[38] = true,
}
function detectWeaponCheat(previousWeaponID, currentWeaponID)
if ( WeaponID[currentWeaponID] ) then
if not hasObjectPermissionTo ( source, "function.mute" ) then
kickPlayer(source, "[AC] : Weapon Hack")
end
end
end
addEventHandler("onPlayerWeaponSwitch", getRootElement(), detectWeaponCheat)