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
-- CONFIG --
checkHook = 'second' -- also you can use: ms100
function speedhackerDetected(id,detectedSpeed,normalSpeed)
	msg('\169000255000AntiCheat: \169255255255'..player(id,'name')..' is using speedhack!')
	msg('\169000255000AntiCheat: \169255255255'..player(id,'name')..' has been kicked.')
	parse('kick '..id)
end
-- CONFIG --
speed = {}
for id = 1,32 do
	speed[id] = 0
end
function _parse(txt)
	local cmd = toTable(txt)
	if cmd[1] == 'speedmod' then
		local id = tonumber(cmd[2])
		local sp = tonumber(cmd[3])
		if (type(id) == 'number') and (type(sp) == 'number') then
			speed[id] = sp
		end
	end
end
function _reset(id)
	speed[id] = 0
end
function _check()
	for _, id in pairs(player(0,'tableliving')) do
		if player(id,'speedmod') ~= speed[id] then
			speedhackerDetected(id,speed[id],player(id,'speedmod'))
		end
	end
end
function toTable(txt,match)
	local cmd = {}
	if not match then match = '[^%s]+' end
	for word in string.gmatch(txt,match) do
		table.insert(cmd,word)
	end
	return cmd
end
addhook('join','_reset',-3)
addhook('leave','_reset',-3)
addhook('die','_reset',-3)
addhook('parse','_parse',-3)
if checkHook ~= 'second' and checkHook ~= 'ms100' then
	checkHook = 'second'
end
addhook(checkHook,'_check',-3)