From c6031adcced19031325f33bb1a26df82e01cc987 Mon Sep 17 00:00:00 2001 From: tokinaa Date: Tue, 24 Oct 2023 14:55:24 +0700 Subject: [PATCH 1/2] fix: Sometimes C4 Position bugged if you look behind the C4, or C4 Screen Pos not in Screen Area --- memory-external/hacks/hack.hpp | 48 ++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/memory-external/hacks/hack.hpp b/memory-external/hacks/hack.hpp index 6f8f166..1c89416 100644 --- a/memory-external/hacks/hack.hpp +++ b/memory-external/hacks/hack.hpp @@ -40,29 +40,37 @@ namespace hack { const Vector3 c4ScreenPos = c4Origin.world_to_screen(view_matrix); - float distance = localOrigin.calculate_distance(c4Origin); - float roundedDistance = std::round(distance / 500.f); + /** + * Sometimes C4 Position bugged if you look behind the C4, or C4 Screen Pos not in Screen Area + * + * Tested in my side + */ - float height = 10 - roundedDistance; - float width = height * 1.4f; + if (c4ScreenPos.z >= 0.01f) { + float distance = localOrigin.calculate_distance(c4Origin); + float roundedDistance = std::round(distance / 500.f); - render::DrawFilledBox( - g::hdcBuffer, - c4ScreenPos.x - (width / 2), - c4ScreenPos.y - (height / 2), - width, - height, - config::esp_box_color_enemy - ); + float height = 10 - roundedDistance; + float width = height * 1.4f; - render::RenderText( - g::hdcBuffer, - c4ScreenPos.x + (width / 2 + 5), - c4ScreenPos.y, - "C4", - config::esp_name_color, - 10 - ); + render::DrawFilledBox( + g::hdcBuffer, + c4ScreenPos.x - (width / 2), + c4ScreenPos.y - (height / 2), + width, + height, + config::esp_box_color_enemy + ); + + render::RenderText( + g::hdcBuffer, + c4ScreenPos.x + (width / 2 + 5), + c4ScreenPos.y, + "C4", + config::esp_name_color, + 10 + ); + } } int playerIndex = 0; From 058f439229149606e995303202294a33e83e5f21 Mon Sep 17 00:00:00 2001 From: tokinaa Date: Tue, 24 Oct 2023 14:55:58 +0700 Subject: [PATCH 2/2] fix: removing useless text --- memory-external/hacks/hack.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/memory-external/hacks/hack.hpp b/memory-external/hacks/hack.hpp index 1c89416..68c7125 100644 --- a/memory-external/hacks/hack.hpp +++ b/memory-external/hacks/hack.hpp @@ -42,10 +42,7 @@ namespace hack { /** * Sometimes C4 Position bugged if you look behind the C4, or C4 Screen Pos not in Screen Area - * - * Tested in my side */ - if (c4ScreenPos.z >= 0.01f) { float distance = localOrigin.calculate_distance(c4Origin); float roundedDistance = std::round(distance / 500.f);