Вопрос После 1 плента работает всегда (BombTimer)

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
19 Янв 2024
Сообщения
170
Реакции
5
Столкнулся с проблемой
Не определяет Сайт бомбы
Не определяет время
Перепробовал кучу вариантов не работает(Оффсеты последние)
Как только не делал проверок все равно
C++:
Expand Collapse Copy
void BombTimer() {
    if (!Vars::BombTimer)
        return;

    auto local = Entities->GetLocalPlayer();
    if (!local)
        return;

    uintptr_t plantedC4 = *reinterpret_cast<uintptr_t*>(CEntities::Client + Offsets::dwPlantedC4);
    if (!plantedC4)
        return;

    bool bombTicking = *reinterpret_cast<bool*>(plantedC4 + 0x1160);
    if (!bombTicking)
        return;

    bool bombDefused = *reinterpret_cast<bool*>(plantedC4 + 0x11B4);
    if (bombDefused)
        return;

    bool hasExploded = *reinterpret_cast<bool*>(plantedC4 + 0x1195);
    if (hasExploded)
        return;

    int site = *reinterpret_cast<int*>(plantedC4 + 0x1164);
    float blowTime = *reinterpret_cast<float*>(plantedC4 + 0x1190);
    bool beingDefused = *reinterpret_cast<bool*>(plantedC4 + 0x119C);

    uintptr_t globalVars = *reinterpret_cast<uintptr_t*>(CEntities::Client + Offsets::dwGlobalVars);
    float currentTime = 0.0f;

    if (globalVars) {
        currentTime = *reinterpret_cast<float*>(globalVars + 0x10);
    }

    float timeRemaining = blowTime - currentTime;

    if (timeRemaining <= 0.0f || timeRemaining > 60.0f)
        timeRemaining = 0.0f;

    const char* bombSite = "Unknown";
    if (site == 0)
        bombSite = "A";
    else if (site == 1)
        bombSite = "B";

    ImDrawList* draw = ImGui::GetForegroundDrawList();

    ImVec2 screen_center = ImGui::GetIO().DisplaySize;
    screen_center.x /= 2.0f;
    screen_center.y /= 2.0f;

    const ImVec2 position = ImVec2(screen_center.x - 100, screen_center.y + 400);
    const std::string icon = ICON_FA_BOMB;
    const std::string text = std::string("Bomb Site: ") + bombSite;

    char timerText[32];
    if (timeRemaining > 0.0f)
        sprintf_s(timerText, "Time: %.1f s", timeRemaining);
    else
        sprintf_s(timerText, "Time: --.-");

    std::string statusText = beingDefused ? "Status: Defusing" : "Status: Active";

    const ImVec2 icon_size = ImGui::CalcTextSize(icon.c_str());
    const ImVec2 text_size = ImGui::CalcTextSize(text.c_str());
    const ImVec2 timer_size = ImGui::CalcTextSize(timerText);
    const ImVec2 status_size = ImGui::CalcTextSize(statusText.c_str());
    const ImVec2 padding = ImVec2(8, 6);

    float max_width = icon_size.x + text_size.x;
    if (status_size.x > max_width) max_width = status_size.x;
    if (timer_size.x > max_width) max_width = timer_size.x;

    const ImVec2 box_size = ImVec2(max_width + padding.x * 4, text_size.y + status_size.y + timer_size.y + padding.y * 4);

    ImVec2 min = position;
    ImVec2 max = ImVec2(position.x + box_size.x, position.y + box_size.y);

    float rounding = ImGui::GetStyle().WindowRounding * 2.0f;
    float time = ImGui::GetTime();
    bool blink = fmod(time, 1.0f) > 0.5f;

    ImColor statusColor = beingDefused
        ? (blink ? ImColor(60, 150, 255) : ImColor(130, 180, 255))
        : (blink ? ImColor(255, 60, 60) : ImColor(255, 130, 130));

    ImColor timerColor;
    if (timeRemaining > 10.0f)
        timerColor = ImColor(130, 255, 130);
    else if (timeRemaining > 5.0f)
        timerColor = ImColor(255, 200, 60);
    else
        timerColor = blink ? ImColor(255, 30, 30) : ImColor(255, 100, 100);

    draw->AddRectFilled(min, max, ImColor(20, 20, 20, 180), rounding);
    draw->AddRect(min, max, ImColor(255, 255, 255, 25), rounding, 0, 1.4f);
    draw->AddRect(ImVec2(min.x + 1, min.y + 1), ImVec2(max.x - 1, max.y - 1), ImColor(255, 255, 255, 15), rounding);

    ImVec2 text_pos = ImVec2(min.x + padding.x, min.y + padding.y);
    draw->AddText(text_pos, helpers.get_accent_imcolor(ImGui::GetStyle().Alpha, 1.f), icon.c_str());
    draw->AddText(ImVec2(text_pos.x + icon_size.x + padding.x, text_pos.y), ImColor(255, 255, 255), text.c_str());

    text_pos.y += text_size.y + padding.y / 2;
    draw->AddText(text_pos, statusColor, statusText.c_str());

    text_pos.y += status_size.y + padding.y / 2;
    draw->AddText(text_pos, timerColor, timerText);
}
 
dwPlantedC4 = g_pMemory->Read<uintptr_t>(g_clientDllBase + cs2_dumper::offsets::client_dll::dwPlantedC4);
bombSite = g_pMemory->Read<int>(dwPlantedC4 + cs2_dumper::schemas::client_dll::C_PlantedC4::m_nBombSite);
return (bombSite != 1) ? "A" : "B";
Должно прекрасно определять что за сайт
А время
timerLength = g_pMemory->Read<float>(dwPlantedC4 + cs2_dumper::schemas::client_dll::C_PlantedC4::m_flTimerLength);
m_bombPlantTime = (timerLength > 0.0f && timerLength < 100.0f) ? timerLength : 40.0f;
float bombTime = timerLength - ((clock() - m_bombPlantTime) / (float)CLOCKS_PER_SEC);
возможно немного неправильно и можно легче
 
dwPlantedC4 = g_pMemory->Read<uintptr_t>(g_clientDllBase + cs2_dumper::offsets::client_dll::dwPlantedC4);
bombSite = g_pMemory->Read<int>(dwPlantedC4 + cs2_dumper::schemas::client_dll::C_PlantedC4::m_nBombSite);
return (bombSite != 1) ? "A" : "B";
Должно прекрасно определять что за сайт
А время
timerLength = g_pMemory->Read<float>(dwPlantedC4 + cs2_dumper::schemas::client_dll::C_PlantedC4::m_flTimerLength);
m_bombPlantTime = (timerLength > 0.0f && timerLength < 100.0f) ? timerLength : 40.0f;
float bombTime = timerLength - ((clock() - m_bombPlantTime) / (float)CLOCKS_PER_SEC);
возможно немного неправильно и можно легче
Спасибо, попробую.
 
Назад
Сверху Снизу