/// <summary> /// Получение цели /// </summary> /// <param name="entity"></param> /// <param name="weapon"></param> /// <returns></returns> private PlayerBase GetTarget(PlayerBase entity, CAimWeapon weapon, TeamID entityTeam, TeamID playerBaseTeam) { if ((entityTeam == playerBaseTeam && !ConfigManager.CAimMisc.DangerZoneActive) || (ConfigManager.CAimMisc.PlayerInAirActive && Base.LocalPlayer.BhopFlag()) || (ConfigManager.CAimMisc.EnemyInAirActive && entity.InAir())) { return(IntPtr.Zero); } else if (Vector.GetFov(VEngineClient.ViewAngels, entity.AngleToTarget(true, weapon.WeaponBone, weapon.RcsValue, weapon.RcsActive)) <= weapon.WeaponFov) { if (entity.SpottedByMask > 0) { return(entity); } } return(IntPtr.Zero); }
public void Tick(TeamID playerBaseTeam) { if (ConfigManager.CAim.AimActive) { ActiveWeapon = ConfigManager.CAimWeapon[GetWeaponID(BaseWeapon.ActiveWeaponIndex)]; if (NativeMethods.GetAsyncKeyState(KeysCode.MS_Click1)) { if (ActiveWeapon.WeaponActive && BaseWeapon.ActiveWeaponClip > 0) { if (!IsClosed) { if (Base.LocalPlayer.CrosshairId > 0 && Base.LocalPlayer.CrosshairId < VEngineClient.MaxPlayers) { PlayerBase crosshairPlayer = IClientEntityList.GetClientEntity(Base.LocalPlayer.CrosshairId).GetPlayer; m_Entity = GetTarget(crosshairPlayer, ActiveWeapon, crosshairPlayer.Team, playerBaseTeam); } else { m_Entity = NearestTarget(); } IsClosed = true; } if (m_Entity && m_Entity.Health != 0) { if (ActiveWeapon.SilentActive && Base.LocalPlayer.Bullet(false)) { SetViewAngelSilent(m_Entity.AngleToTarget(false, ActiveWeapon.WeaponBone, ActiveWeapon.RcsValue, ActiveWeapon.RcsActive)); } else { VEngineClient.ViewAngels = Vector.SmoothAngle(VEngineClient.ViewAngels, m_Entity.AngleToTarget(true, ActiveWeapon.WeaponBone, ActiveWeapon.RcsValue, ActiveWeapon.RcsActive), ActiveWeapon.Smooth); } } else { IsClosed = false; } if (ActiveWeapon.RcsStandaloneActive && Base.LocalPlayer.Bullet(true)) { RcsStandalone(ActiveWeapon.RcsStandaloneX, ActiveWeapon.RcsStandaloneY); } } if (ConfigManager.CAimMisc.MouseAttackActive) { VClient.SetForceAttack(VClient.SUserCMD.ButtonID.IN_ATTACK); } } else { OldAngle.X = OldAngle.Y = 0.0f; IsClosed = false; VClient.SetForceAttack(VClient.SUserCMD.ButtonID.IN_NOATTACK); } } }