1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("hit","_hit",1337)
function _hit(id,source)
if player(id,"exists") and player(source,"exists") then
if ANTIHACK[source].aimbot > 0 then
reqcld(source,0)
else
ANTIHACK[source].hit = ANTIHACK[source].hit + 1
if ANTIHACK[source].hit > 3 then
reqcld(source,0)
ANTIHACK[source].hit = 0
end
end
end
end
addhook("clientdata","_clientdata",1337)
function _clientdata(id,mode,data1,data2)
if mode == 0 then
anti_aimbot(id,data1,data2)
end
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function anti_aimbot(id,data1,data2)
local radius = math.floor(math.sqrt((320-data1)^2 + (240-data2)^2))
if radius >= ANTIHACK[id].aimbotradius - 2 and radius <= ANTIHACK[id].aimbotradius + 2 then
ANTIHACK[id].aimbot = ANTIHACK[id].aimbot + 1
if ANTIHACK[id].aimbot >= 3 then
msg("\169255150150[THEDARKNESS2D]:\169255255255 "..player(id,"name").." has been detected of using aimbot, temp. banned!")
log_report(id,"Aimbot")
ANTIHACK[id].aimbot = 0
end
else
if ANTIHACK[id].aimbot > 0 then
ANTIHACK[id].aimbot = 0
end
end
ANTIHACK[id].aimbotradius = radius
end
@
DC has written
1. This solution doesn't handle network problems correctly. High pings, packet loss, etc. Those are the actual problems which make 100% reliable cheat detection impossible in practice on a real server with real network conditions and with real connections from all around the world.
2. Also - of course - cheaters can (and will, believe me!) very easily manipulate the mouse coordinates which are sent for reqcld. This renders the whole detection useless.
3. Cheaters may also opt for another way to implement the aimbot: Don't point exactly at the player (or a radius around it) but just point somewhere at the LINE which gives them the right angle. Because: Only the RESULTING angle of the own player is important. It doesn't matter how it's achieved.
Your attempt to help is appreciated but this is not a reliable way to detect cheats. It may work for a few days but it's easy to find out how it's done and how to trick it.