[CODE]Aimbot_Detection_Time = 30 -- In seconds, how long will it take to alert admins after being detected? (like if they stop aimbotting this wont tell admins)
Aimbot_Staff = { "moderator", "admin", "superadmin" }
hook.Add( "PlayerInitialSpawn", "Aimbot_Detection_Unit", function( ply )
ply._suspect = false
ply._hitbox = false
timer.Create( "Aimbot_Detecting", 0.01, 0, function()
local victim = ply:GetEyeTrace().Entity
local hitbox = ply:GetEyeTrace().HitGroup
if IsValid( victim ) and ( victim:IsPlayer() or victim:IsBot() ) then
if not ply._hitbox then
print( hitbox .. "" .. victim:Nick() )
ply._hitbox = hitbox
timer.Create( "HitBox_Detection", Aimbot_Detection_Time/2, 1, function()
if ply._hitbox == hitbox then
ply._suspect = true
print( ply:Nick().." Might be hitbox hacking.." )
end
end )
end
end
if ply._suspect then
ply._eyeangles = ply:EyeAngles()
if victim:IsPlayer() then
timer.Create( "Aimbot_Detection", 1, 0, function()
if ply._eyeangles != ply:EyeAngles() then
if victim:IsPlayer() then
timer.Remove( "Aimbot_Detection" )
timer.Create( "Aimbot_Happening", 1, Aimbot_Detection_Time/2, function()
if ply._eyeangles != ply:EyeAngles() then
ply._aimbot_detected = ply._aimbot_detected + 1
if ply._aimbot_detected >= Aimbot_Detection_Time/2 then
for k,v in pairs( player.GetAll() ) do
if table.HasValue( Aimbot_Staff, v:GetUserGroup() ) then
v:PrintMessage( HUD_PRINTTALK, "Anti-Aimbot" .. ply:Nick() .. " Has detections of Aimbot, please spectate." )
end
end
ply._suspect = false
ply._hitbox = false
end
end
end )
else
ply._suspect = false
ply._hitbox = false
timer.Remove( "Aimbot_Detection" )
end
end
end )
end
end
end )
end )
[/CODE]
I am just detecting if someone MIGHT be aimbotting then telling admins?
But its not working? Anyone know?
[editline]30th July 2017[/editline]
(addon works etc, just detection is not working?)
Using named timers is not going to work when you want 1 timer per player. Think about. Player 1 joins, your PlayerInitialSpawn hook is called and creates a timer called Aimbot_Detecting. Player 2 joins, your PlayerInitialSpawn hook is called, and creates a new (overwrites) timer called Aimbot_Detecting. You need a unique name for your timers, or use timer.Simple
Also, this detection method is extremely inaccurate.
Mother of nesting
[QUOTE=code_gs;52521873]Also, this detection method is extremely inaccurate.[/QUOTE]
Can you give me a tip to fix up my code? because people are using a new hack engine that bypasses cac so.. im having trouble detecting aimbot.
[QUOTE=JacobsReturn;52524993]Can you give me a tip to fix up my code? because people are using a new hack engine that bypasses cac so.. im having trouble detecting aimbot.[/QUOTE]
The cheats that are bypassing CAC aren't going to have an easy detection method like that. There are some people currently working on a solution, though.
Just cache their angles with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CUserCmd/GetViewAngles]CUserCmd:GetViewAngles[/url] and when they get a kill check if they snapped over ~45 degrees in a single tick.
[QUOTE=Sean Bean;52525030]Just cache their angles with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CUserCmd/GetViewAngles]CUserCmd:GetViewAngles[/url] and when they get a kill check if they snapped over ~45 degrees in a single tick.[/QUOTE]
This is really inaccurate on low tick servers and will net alot of false positives.
[QUOTE=ThatLing;52525228]This is really inaccurate on low tick servers and will net alot of false positives.[/QUOTE]
I was just giving an idea how to make a simple aimbot detection. Obviously it isn't going to be perfect, but no aimbot detection method is 100% accurate.
Your script is not good because you are creating a timer of 100Hz, per players !
The method you are describing here is not accurate enough.
Look at how csgo works :
- VAC is scanning running tasks, scanning if variables are being edited illegaly, and if a dll is being injected ;
- CSGO's overwatch is a replay of a .dem, and players juge if they are watching a cheater aimboting.
Conclusion :
The best option is to give your admins a spectating feature (which already exist in many admin addons), and give your players a "Report a player" menu.
Sorry, you need to Log In to post a reply to this thread.