Исходник Плавный Health Bar для вашей пасты лв

Начинающий
Статус
Оффлайн
Регистрация
18 Мар 2021
Сообщения
68
Реакции[?]
29
Поинты[?]
1K
C++:
void playeresp::draw_health(player_t* m_entity, const Box& box)
{
    if (!g_cfg.player.type[type].health)
        return;

    if (!m_engine()->IsReplay())
        return;

    auto alpha = (int)(255.0f * esp_alpha_fade[m_entity->EntIndex()]);
    auto back_color = Color(0, 0, 0, (int)(alpha * 0.6f));
    constexpr float SPEED_FREQ = 255 / 1.0f;
    int hp = m_entity->m_iHealth();

    if (hp > 100)
        hp = 100;


    int red = 255 - (hp * 2.55);
    int green = hp * 2.55;

    Box n_box =
    {
        box.x - 5,
        box.y,
        2,
        box.h
    };

    auto hp_color = m_entity->IsDormant() ? Color(130, 130, 130) : Color(150, (int)min(255.0f, hp * 225.0f / 100.0f), 0);

    if (g_cfg.player.type[type].custom_health_color)
        hp_color = m_entity->IsDormant() ? Color(130, 130, 130) : g_cfg.player.type[type].health_color;

    hp_color.SetAlpha(min(alpha, hp_color.a()));

    static float prev_player_hp[65];

    if (prev_player_hp[m_entity->EntIndex()] > hp)
        prev_player_hp[m_entity->EntIndex()] -= SPEED_FREQ * m_globals()->m_frametime;
    else
        prev_player_hp[m_entity->EntIndex()] = hp;

    int hp_percent = box.h - (int)((box.h * prev_player_hp[m_entity->EntIndex()]) / 100);
    int hp_percentw = box.w - (int)((box.w * prev_player_hp[m_entity->EntIndex()]) / 100);

    int healthpos_X = 0;
    int healthpos_Y = 0;

    render::get().rect(box.x - 6, box.y, 4, box.h, back_color);

    render::get().rect_filled(n_box.x, n_box.y - 1, 2, n_box.h + 2, back_color);
    render::get().rect_filled(n_box.x, n_box.y + hp_percent, 2, box.h - hp_percent, hp_color);

    if (hp < 100)
        render::get().text(fonts[ESP], n_box.x + 1, n_box.y + hp_percent, Color(255, 255, 255), HFONT_CENTERED_X | HFONT_CENTERED_Y, std::to_string(hp).c_str());
}
 
Начинающий
Статус
Оффлайн
Регистрация
12 Мар 2022
Сообщения
75
Реакции[?]
4
Поинты[?]
5K
C++:
void playeresp::draw_health(player_t* m_entity, const Box& box)
{
    if (!g_cfg.player.type[type].health)
        return;

    if (!m_engine()->IsReplay())
        return;

    auto alpha = (int)(255.0f * esp_alpha_fade[m_entity->EntIndex()]);
    auto back_color = Color(0, 0, 0, (int)(alpha * 0.6f));
    constexpr float SPEED_FREQ = 255 / 1.0f;
    int hp = m_entity->m_iHealth();

    if (hp > 100)
        hp = 100;


    int red = 255 - (hp * 2.55);
    int green = hp * 2.55;

    Box n_box =
    {
        box.x - 5,
        box.y,
        2,
        box.h
    };

    auto hp_color = m_entity->IsDormant() ? Color(130, 130, 130) : Color(150, (int)min(255.0f, hp * 225.0f / 100.0f), 0);

    if (g_cfg.player.type[type].custom_health_color)
        hp_color = m_entity->IsDormant() ? Color(130, 130, 130) : g_cfg.player.type[type].health_color;

    hp_color.SetAlpha(min(alpha, hp_color.a()));

    static float prev_player_hp[65];

    if (prev_player_hp[m_entity->EntIndex()] > hp)
        prev_player_hp[m_entity->EntIndex()] -= SPEED_FREQ * m_globals()->m_frametime;
    else
        prev_player_hp[m_entity->EntIndex()] = hp;

    int hp_percent = box.h - (int)((box.h * prev_player_hp[m_entity->EntIndex()]) / 100);
    int hp_percentw = box.w - (int)((box.w * prev_player_hp[m_entity->EntIndex()]) / 100);

    int healthpos_X = 0;
    int healthpos_Y = 0;

    render::get().rect(box.x - 6, box.y, 4, box.h, back_color);

    render::get().rect_filled(n_box.x, n_box.y - 1, 2, n_box.h + 2, back_color);
    render::get().rect_filled(n_box.x, n_box.y + hp_percent, 2, box.h - hp_percent, hp_color);

    if (hp < 100)
        render::get().text(fonts[ESP], n_box.x + 1, n_box.y + hp_percent, Color(255, 255, 255), HFONT_CENTERED_X | HFONT_CENTERED_Y, std::to_string(hp).c_str());
}
во что кидать
 
Эксперт
Статус
Оффлайн
Регистрация
30 Дек 2019
Сообщения
1,970
Реакции[?]
958
Поинты[?]
19K
сори что слил "твой крутой" код
 
Начинающий
Статус
Оффлайн
Регистрация
18 Мар 2021
Сообщения
68
Реакции[?]
29
Поинты[?]
1K
сори что слил "твой крутой" код
там на имгуе и нету градиента, можешь сравнить код
+ не на лв и причем тут "слил"
 
Забаненный
Статус
Оффлайн
Регистрация
18 Июн 2023
Сообщения
4
Реакции[?]
3
Поинты[?]
1K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Эксперт
Статус
Оффлайн
Регистрация
30 Дек 2019
Сообщения
1,970
Реакции[?]
958
Поинты[?]
19K
как же тяжело готовый код вставить, я вахуи
в чём разница имгуи и любого другого рендера?
нету градиента
ачуметь, 2 кнопки нажать нынче сложно
 
Начинающий
Статус
Оффлайн
Регистрация
12 Мар 2022
Сообщения
75
Реакции[?]
4
Поинты[?]
5K
C++:
void playeresp::draw_health(player_t* m_entity, const Box& box)
{
    if (!g_cfg.player.type[type].health)
        return;

    if (!m_engine()->IsReplay())
        return;

    auto alpha = (int)(255.0f * esp_alpha_fade[m_entity->EntIndex()]);
    auto back_color = Color(0, 0, 0, (int)(alpha * 0.6f));
    constexpr float SPEED_FREQ = 255 / 1.0f;
    int hp = m_entity->m_iHealth();

    if (hp > 100)
        hp = 100;


    int red = 255 - (hp * 2.55);
    int green = hp * 2.55;

    Box n_box =
    {
        box.x - 5,
        box.y,
        2,
        box.h
    };

    auto hp_color = m_entity->IsDormant() ? Color(130, 130, 130) : Color(150, (int)min(255.0f, hp * 225.0f / 100.0f), 0);

    if (g_cfg.player.type[type].custom_health_color)
        hp_color = m_entity->IsDormant() ? Color(130, 130, 130) : g_cfg.player.type[type].health_color;

    hp_color.SetAlpha(min(alpha, hp_color.a()));

    static float prev_player_hp[65];

    if (prev_player_hp[m_entity->EntIndex()] > hp)
        prev_player_hp[m_entity->EntIndex()] -= SPEED_FREQ * m_globals()->m_frametime;
    else
        prev_player_hp[m_entity->EntIndex()] = hp;

    int hp_percent = box.h - (int)((box.h * prev_player_hp[m_entity->EntIndex()]) / 100);
    int hp_percentw = box.w - (int)((box.w * prev_player_hp[m_entity->EntIndex()]) / 100);

    int healthpos_X = 0;
    int healthpos_Y = 0;

    render::get().rect(box.x - 6, box.y, 4, box.h, back_color);

    render::get().rect_filled(n_box.x, n_box.y - 1, 2, n_box.h + 2, back_color);
    render::get().rect_filled(n_box.x, n_box.y + hp_percent, 2, box.h - hp_percent, hp_color);

    if (hp < 100)
        render::get().text(fonts[ESP], n_box.x + 1, n_box.y + hp_percent, Color(255, 255, 255), HFONT_CENTERED_X | HFONT_CENTERED_Y, std::to_string(hp).c_str());
}
блять обьясни где заменить код и всё
 
Ревёрсер среднего звена
Пользователь
Статус
Оффлайн
Регистрация
24 Ноя 2022
Сообщения
303
Реакции[?]
107
Поинты[?]
56K
Сверху Снизу