function apocalypse.IsVisible(ent) local pos = LocalPlayer():GetShootPos() local ang = LocalPlayer():GetAimVector() local trace = {start = LocalPlayer():GetShootPos(), endpos = ent:GetAttachment(ent:LookupAttachment("eyes")).Pos, filter = {LocalPlayer(), ent}, mask = 1174421507}; local tr = util.TraceLine(trace); return(tr.Fraction == 1); end function apocalypse.CanTarget(pl) if not(G.IsValid(pl) and pl:IsPlayer() and apocalypse.IsVisible(pl) and pl:Alive() and pl:Health() > 0) then return false; end if not(pl ~= LocalPlayer() and LocalPlayer():Alive() and LocalPlayer():Team() ~= TEAM_SPECTATOR) then return false; end local fov = apocalypse.Settings["aimbot_fov"] if(fov ~= 180)then local lpang = LocalPlayer():GetAngles() local ang = (pl:GetPos() - LocalPlayer():GetPos()):Angle() local ady = math.abs(math.NormalizeAngle(lpang.y - ang.y)) local adp = math.abs(math.NormalizeAngle(lpang.p - ang.p)) if(ady > fov or adp > fov) then return false; end end return true; end function apocalypse.GetTarget() if apocalypse.Target and apocalypse.CanTarget(apocalypse.Target) then return apocalypse.Target; end apocalypse.Target = nil for _,potential in pairs(player.GetAll()) do if potential and apocalypse.CanTarget(potential) then apocalypse.Target = potential end end return apocalypse.Target; end function apocalypse.Aimbot(uc) if not(apocalypse.Settings["aimbot"]) then return; end local Target = apocalypse.GetTarget() if not(Target)then return end; local pos, ang if apocalypse.Settings["aimbot_bone"] then if Target:LookupBone("ValveBiped.Bip01_Spine") then pos, ang = Target:GetBonePosition(Target:LookupBone("ValveBiped.Bip01_Spine")) end else if Target:LookupAttachment("eyes") then pos = Target:GetAttachment(Target:LookupAttachment("eyes")) end end if pos and pos.Pos then --_R.CUserCmd:SetViewAngles((pos.Pos - LocalPlayer():GetShootPos()):Angle()) LocalPlayer():SetEyeAngles((pos.Pos - LocalPlayer():GetShootPos()):Angle()) end end