private void ThreadDirectX(object sender) { while (true) { device.BeginDraw(); device.Clear(Color.Transparent); device.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Aliased; List <BHelper.PlayerDraw> PlayerDataBuffer = Bluehack.PlayerDraws; for (int i = 0; i < PlayerDataBuffer.Count; i++) { BHelper.PlayerDraw PlayerData = PlayerDataBuffer[i]; DrawPlayerHealth(PlayerData.espX, PlayerData.espY, PlayerData.espDistance, PlayerData.PlayerHealth); DrawPlayerHead(PlayerData.espX, PlayerData.espY, PlayerData.espDistance); DrawPlayerBones(PlayerData.Bones); } List <BHelper.EntityDraw> EntityDataBuffer = Bluehack.EntityDraws; for (int i = 0; i < EntityDataBuffer.Count; i++) { BHelper.EntityDraw EntityData = EntityDataBuffer[i]; if (Enum.IsDefined(typeof(BHelper.AcceptedGrenadeIDS), EntityData.EntityClassID)) { DrawEntityGrenade(EntityData.espX, EntityData.espY, EntityData.espDistance, EntityData.EntityClassID, EntityData.EntityModel); } } float[] Punch = BHelper.LocalPlayer.GetPunch(); DrawPlayerCrosshair(Punch[0], Punch[1]); device.EndDraw(); Thread.Sleep(10); } }
static BHelper.EntityDraw FindEntityDrawByBase(List <BHelper.EntityDraw> list, int Base) { BHelper.EntityDraw toRemove = new BHelper.EntityDraw(); foreach (BHelper.EntityDraw EntityInfo in list) { if (EntityInfo.EntityBase == Base) { toRemove = EntityInfo; break; } } return(toRemove); }
static void ThreadESP() { while (true) { #region Player ESP for (int i = 0; i < 32; i++) { bool IsAlive = BHelper.EntityList.GetLifeState(i); int Base = BHelper.EntityList.Base(i); if (IsAlive && Base != BHelper.LocalPlayer.Base() && Base != 0 && !BHelper.EntityList.GetDormant(i) && BHelper.EntityList.GetTeam(i) != BHelper.LocalPlayer.GetTeam()) { float[] EnemyHeadPos = BHelper.EntityList.GetBonePosition(i, 8); float[] PlayerPos = BHelper.LocalPlayer.GetPosition(); float[] ScreenPos = new float[2]; if (WorldToScreen(i, EnemyHeadPos, ref ScreenPos)) { BHelper.PlayerDraw PlayerInfo = new BHelper.PlayerDraw(); PlayerInfo.PlayerBase = Base; PlayerInfo.PlayerID = i; PlayerInfo.PlayerTeam = BHelper.EntityList.GetTeam(i); PlayerInfo.PlayerHealth = BHelper.EntityList.GetHealth(i); PlayerInfo.espX = ScreenPos[0]; PlayerInfo.espY = ScreenPos[1]; PlayerInfo.espDistance = (float)Math.Sqrt((EnemyHeadPos[0] - PlayerPos[0]) * (EnemyHeadPos[0] - PlayerPos[0]) + (EnemyHeadPos[1] - PlayerPos[1]) * (EnemyHeadPos[1] - PlayerPos[1]) + (EnemyHeadPos[2] - PlayerPos[2]) * (EnemyHeadPos[2] - PlayerPos[2])); PlayerInfo.Bones = new float[44]; int[,] BonePairs; if (PlayerInfo.PlayerTeam == 3) { BonePairs = BonePairsCT; } else { BonePairs = BonePairsT; } for (int i_1 = 0; i_1 < 11; i_1++) { float[] EnemyBonePos1 = BHelper.EntityList.GetBonePosition(i, BonePairs[i_1, 0]); float[] EnemyBonePos2 = BHelper.EntityList.GetBonePosition(i, BonePairs[i_1, 1]); float[] ScreenPosBone1 = new float[2]; float[] ScreenPosBone2 = new float[2]; if (WorldToScreen(i, EnemyBonePos1, ref ScreenPosBone1) && WorldToScreen(i, EnemyBonePos2, ref ScreenPosBone2)) { PlayerInfo.Bones[(i_1 * 4) + 0] = ScreenPosBone1[0]; PlayerInfo.Bones[(i_1 * 4) + 1] = ScreenPosBone1[1]; PlayerInfo.Bones[(i_1 * 4) + 2] = ScreenPosBone2[0]; PlayerInfo.Bones[(i_1 * 4) + 3] = ScreenPosBone2[1]; } } int PlayerIndex = FindPlayerDrawIndexByBase(PlayerDraws, Base); if (PlayerIndex == -1) { PlayerDraws.Add(PlayerInfo); } else { PlayerDraws[PlayerIndex] = PlayerInfo; } } } else { PlayerDraws.Remove(FindPlayerDrawByBase(PlayerDraws, Base)); } } #endregion #region Entity ESP for (int i = 0; i < 1000; i++) { int Base = BHelper.EntityList.Base(i); if (Base == 0) { continue; } int ClassID = BHelper.EntityList.GetEntityID(Base); if (Enum.IsDefined(typeof(BHelper.AcceptedGrenadeIDS), ClassID)) { float[] EntityPos = BHelper.EntityList.GetPosition(i); float[] PlayerPos = BHelper.LocalPlayer.GetPosition(); float[] ScreenPos = new float[2]; if (WorldToScreen(i, EntityPos, ref ScreenPos)) { BHelper.EntityDraw EntityInfo = new BHelper.EntityDraw(); EntityInfo.EntityBase = Base; EntityInfo.EntityClassID = ClassID; EntityInfo.EntityID = i; EntityInfo.EntityModel = BHelper.EntityList.GetModel(i); EntityInfo.espX = ScreenPos[0]; EntityInfo.espY = ScreenPos[1]; EntityInfo.espDistance = (float)Math.Sqrt((EntityPos[0] - PlayerPos[0]) * (EntityPos[0] - PlayerPos[0]) + (EntityPos[1] - PlayerPos[1]) * (EntityPos[1] - PlayerPos[1]) + (EntityPos[2] - PlayerPos[2]) * (EntityPos[2] - PlayerPos[2])); int EntityIndex = FindEntityDrawIndexByBase(EntityDraws, Base); if (EntityIndex == -1) { EntityDraws.Add(EntityInfo); } else { EntityDraws[EntityIndex] = EntityInfo; } } } } for (int i = 0; i < EntityDraws.Count; i++) { if (EntityDraws[i].EntityBase != BHelper.EntityList.Base(EntityDraws[i].EntityID)) { EntityDraws.Remove(FindEntityDrawByBase(EntityDraws, EntityDraws[i].EntityBase)); } } #endregion Thread.Sleep(1); } }