public static void LegitInitialize(EntityBase *EntityBase, TeamID EntityTeam, TeamID PlayerBaseTeam) { ActiveWeapon = ConfigManager.CAimWeapon[Starting.GetWeaponID(BaseWeapon.ActiveWeaponIndex)]; if (NativeMethods.GetAsyncKeyState(KeysCode.MS_Click1)) { if (ActiveWeapon.WeaponActive && BaseWeapon.ActiveWeaponClip > 0) { if (!IsClosed) { entity = GetTarget(EntityBase, ActiveWeapon, EntityTeam, PlayerBaseTeam); IsClosed = true; } if (entity != null && entity->Health > 0) { if (ActiveWeapon.SilentActive && BasePlayer.Bullet(false)) { SetViewAngelSilent(AngelToTarget(entity, ActiveWeapon.WeaponBone, ActiveWeapon.RcsValue, ActiveWeapon.RcsActive)); } else { VEngineClient.ViewAngels = Vector.SmoothAngle(VEngineClient.ViewAngels, AngelToTarget(entity, ActiveWeapon.WeaponBone, ActiveWeapon.RcsValue, ActiveWeapon.RcsActive), ActiveWeapon.Smooth); } } else { IsClosed = false; } if (ActiveWeapon.RcsStandaloneActive && BasePlayer.Bullet(true)) { RcsStandalone(ActiveWeapon.RcsStandaloneX, ActiveWeapon.RcsStandaloneY); } } if (ConfigManager.CAimMisc.MouseAttackActive) { VClient.ForceAttack = VClient.SUserCMD.ButtonID.IN_ATTACK; } } else { OldAngle.X = OldAngle.Y = 0.0f; IsClosed = false; VClient.ForceAttack = VClient.SUserCMD.ButtonID.IN_NOATTACK; } }
/// <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); }
/// <summary> /// Получение цели /// </summary> /// <param name="Entity"></param> /// <param name="CAimWeapon"></param> /// <returns></returns> private static EntityBase *GetTarget(EntityBase *Entity, CAimWeapon CAimWeapon, TeamID EntityTeam, TeamID PlayerBaseTeam) { if ((EntityTeam == PlayerBaseTeam && !ConfigManager.CAimMisc.DangerZoneActive) || (ConfigManager.CAimMisc.PlayerInAirActive && BasePlayer.BhopFlag()) || (ConfigManager.CAimMisc.EnemyInAirActive && Entity->InAir())) { return(null); } else if (Vector.GetFov(VEngineClient.ViewAngels, AngelToTarget(Entity, CAimWeapon.WeaponBone, CAimWeapon.RcsValue, CAimWeapon.RcsActive)) <= CAimWeapon.WeaponFov) { if (ConfigManager.CAimMisc.VisibleID == VisibleID.Spotted && Entity->Spotted == 1) { return(Entity); } else if (ConfigManager.CAimMisc.VisibleID == VisibleID.SpottedByMask && Entity->SpottedByMask > 0) { return(Entity); } } return(null); }
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); } } }