diff --git a/memory-external/hacks/hack.hpp b/memory-external/hacks/hack.hpp index 7a02b9d..d399368 100644 --- a/memory-external/hacks/hack.hpp +++ b/memory-external/hacks/hack.hpp @@ -43,6 +43,16 @@ namespace hack { { const uintptr_t planted_c4 = process->read(process->read(base_client.base + updater::offsets::dwPlantedC4)); + static auto plantTime = std::chrono::high_resolution_clock::now(); + auto currentTime = std::chrono::high_resolution_clock::now(); + auto elapsedTime = std::chrono::duration(currentTime - plantTime).count(); + + const float c4Timer = process->read(planted_c4 + updater::offsets::m_flTimerLength); + const float c4Beep = process->read(planted_c4 + updater::offsets::m_flNextBeep); + const float c4Blow = process->read(planted_c4 + updater::offsets::m_flC4Blow); + float remainingTime = (c4Blow - c4Beep) / c4Timer; // Constrained to 0.0-1.0 (0.0 being explosion imminent) + remainingTime = remainingTime * 100; // Multiply by 100 to constrain to 0.0-100.00 + const uintptr_t c4Node = process->read(planted_c4 + updater::offsets::m_pGameSceneNode); const Vector3 c4Origin = process->read(c4Node + updater::offsets::m_vecAbsOrigin); @@ -61,7 +71,16 @@ namespace hack { c4ScreenPos.y - (height / 2), width, height, - RGB(0, 185, 255) + RGB((255 - remainingTime), (55 + remainingTime * 2), 75) + ); + + render::RenderText( + g::hdcBuffer, + c4ScreenPos.x + (width / 2 + 5), + c4ScreenPos.y, + ("C4 " + std::to_string(remainingTime)).c_str(), + config::esp_name_color, + 10 ); }