Example #1
0
        public static bool CanKnife()
        {
            foreach (var player in EntityList.List)
            {
                if (player.Dormant)
                {
                    continue;
                }
                if (player.Health <= 0)
                {
                    continue;
                }
                if (player.isTeam && !TriggerbotSettings.TargetTeam)
                {
                    continue;
                }

                if (80 < MathFuncs.VectorDistance(Local.Position, player.Position))
                {
                    continue;
                }

                var newAimAngle = MathFuncs.CalcAngle(Local.EyeLevel, player.BonePosition(4));

                var Fov = MathFuncs.CalcFov(Local.ViewAngle, newAimAngle);

                if (Fov > 70)
                {
                    Fov = MathFuncs.CalcFov(Local.ViewAngle.NormalizeAngle(), newAimAngle.NormalizeAngle());
                }

                if (Fov > 70)
                {
                    continue;
                }

                return(true);
            }

            return(false);
        }