Beispiel #1
0
        private static Vector GetAimAngle()
        {
            var verticalRecoilPercent =
                HackMath.RandomNumber(90, 100) /
                100;
            var horizontalRecoilPercent =
                HackMath.RandomNumber(90, 100) /
                100;

            bool rcsActive = !GameData.LocalPlayer.IsPistol() && !GameData.LocalPlayer.IsSniper() &&
                             GameData.LocalPlayer.ShotsFired > 1;

            var angleToAimFor = HackMath.AngleToTargetWithBonePosition(_boneToAimFor, rcsActive
                                                                                                          ? 2 *
                                                                       horizontalRecoilPercent
                                                                                                          : 0, rcsActive
                                                                                                                       ? 2 *
                                                                       verticalRecoilPercent
                                                                                                                       : 0);

            var aimAngles = GameData.ClientState.ViewAngles.Clone()
                            .Subtract(angleToAimFor);

            aimAngles.X *= -1;
            aimAngles.NormalizeAngle();
            if (!rcsActive && (aimAngles.X < (_activeDistance < 500 ? 0.35f : 0.2f) && aimAngles.X > 0 ||
                               aimAngles.X > -(_activeDistance < 500 ? 0.35f : 0.2f) && aimAngles.X < 0))
            {
                aimAngles.X = 0;
            }

            return(aimAngles);
        }
Beispiel #2
0
        private static void Do(object sender, EventArgs f)
        {
            _timer.Stop();
            try {
                if (Program.OverallActive && 0 < (KeyStateManager.GetAsyncKeyState(Program.Settings.Aimkey) & 0x8000) &&
                    GameData.LocalPlayer.Health > 0 &&
                    !GameData.LocalPlayer.NotUseable())
                {
                    var fov = Program.Settings.FOV + GameData.LocalPlayer.ShotsFired * 3;
                    if (fov > 30)
                    {
                        fov = 30;
                    }

                    var target = GetNearestTargetByFov(fov);

                    if (target != null && target != _lastTarget &&
                        (DateTime.Now - _lastTimeAimed).TotalMilliseconds < 500)
                    {
                        target = null;
                    }

                    if (target != null)
                    {
                        if (DoAim())
                        {
                            _lastTarget     = target;
                            _lastTimeAimed  = DateTime.Now;
                            _timer.Interval = (int)HackMath.RandomNumber(Program.Settings.PausesBetweenAiming
                                                                         , Program.Settings.PausesBetweenAiming + 2);
                        }
                        else
                        {
                            _timer.Interval = 1;
                        }
                    }
                    else
                    {
                        _timer.Interval = 1;
                    }
                }
                else if (GameData.LocalPlayer.IsSniper() || GameData.LocalPlayer.IsPistol())
                {
                    _timer.Interval = 1;
                }
                else
                {
                    _timer.Interval = 20;
                }
            } catch {
                _timer.Interval = 1;
            }

            _timer.Start();
        }