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 )
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?)