Exemple #1
0
        private bool CheckBoneDistance(Player plr, LocalPlayer local, Config.TriggerbotWeaponConfig cfg)
        {
            var localPos  = local.ViewPosition;
            var targetPos = plr.GetBonePosition(cfg.Bone);
            var angle     = Math3.CalcAngle(localPos, targetPos);
            var fov       = Math3.AngleBetweenVec2(CheatMain.clientState.ViewAngles, angle);
            var dist      = Vector3.Distance(localPos, targetPos);

            if (cfg.DynamicFov)
            {
                fov = Math3.GetDistanceFov((float)fov, (float)dist) * 1.4f;
            }

            if (fov <= cfg.Fov)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private Player RcsUpdate()
        {
            if (Config.AimbotBasic.Key != 0 && GetAsyncKeyState((Keys)Config.AimbotBasic.Key) >= 0)
            {
                return(null);
            }

            var localPlayer = CheatMain.client.GetLocalPlayer();

            if (localPlayer.Dead)
            {
                return(null);
            }

            var entityList = CheatMain.client.GetEntityList();
            var plrWeapon  = entityList.FindWeaponByID(localPlayer.ActiveWeaponID - 1);
            var cfgId      = Array.IndexOf(Config.TriggerbotWeaponConfig.TriggerbotWeapons, (int)plrWeapon.WeaponID);

            if (cfgId == -1)
            {
                return(null);
            }

            var cfg = Config.AimbotBasic.WeaponsCfg[cfgId];

            if (!cfg.Enabled)
            {
                return(null);
            }

            if (Enum.IsDefined(typeof(Snipers), (int)plrWeapon.WeaponID))
            {
                return(null);
            }

            var    view    = CheatMain.clientState.ViewAngles;
            var    players = entityList.FindVisiblePlayers(localPlayer);
            double fov;
            var    targetPlr = entityList.FindFovPlayer(localPlayer, players, view - 2f * lastPunchAngles, out fov, Config.AimbotBasic.FFA, cfg.Bone);

            if (targetPlr == null)
            {
                return(null);
            }

            if (enemyFoundTicks < Config.AimbotBasic.DelayBefore)
            {
                return(targetPlr);
            }
            var target = targetPlr.GetBonePosition(8);
            var pos    = localPlayer.ViewPosition;
            var dist   = Vector3.Distance(pos, target);

            var targetView = Math3.CalcAngle(pos, target);
            var punch      = localPlayer.PunchAngles;

            if (cfg.DynamicFov)
            {
                fov = Math3.GetDistanceFov((float)fov, (float)dist) * 1.4f;
            }

            if (fov <= cfg.Fov && punch != lastPunchAngles)
            {
                CheatMain.clientState.ViewAngles = view - 2f * punch + 2f * lastPunchAngles;
            }

            lastPunchAngles = punch;
            return(targetPlr);
        }