designer1337 / csgo-cheat-base

simple csgo internal base.
MIT License
238 stars 50 forks source link

Advanced ESP #86

Open YNXModz opened 3 years ago

YNXModz commented 3 years ago

so uh i worked on esp for a while and it works with this base so ima give it to you guys

its box esp with a dynamic health and armor bar including text and flags

its not the best and the flags esp does need to be updated but i thought id help a lot of you out with this

ESP.cpp

`bool get_playerbox(player_t* ent, box& in) { vec3_t origin, min, max, flb, brt, blb, frt, frb, brb, blt, flt; float left, top, right, bottom;

origin = ent->abs_origin();
min = ent->collideable()->mins() + origin;
max = ent->collideable()->maxs() + origin;

vec3_t points[] = {
    vec3_t(min.x, min.y, min.z),
    vec3_t(min.x, max.y, min.z),
    vec3_t(max.x, max.y, min.z),
    vec3_t(max.x, min.y, min.z),
    vec3_t(max.x, max.y, max.z),
    vec3_t(min.x, max.y, max.z),
    vec3_t(min.x, min.y, max.z),
    vec3_t(max.x, min.y, max.z)
};

if (!interfaces::debug_overlay->world_to_screen(points[3], flb) || !interfaces::debug_overlay->world_to_screen(points[5], brt)
    || !interfaces::debug_overlay->world_to_screen(points[0], blb) || !interfaces::debug_overlay->world_to_screen(points[4], frt)
    || !interfaces::debug_overlay->world_to_screen(points[2], frb) || !interfaces::debug_overlay->world_to_screen(points[1], brb)
    || !interfaces::debug_overlay->world_to_screen(points[6], blt) || !interfaces::debug_overlay->world_to_screen(points[7], flt))
    return false;

vec3_t arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };

left = flb.x;
top = flb.y;
right = flb.x;
bottom = flb.y;

for (int i = 1; i < 8; i++) {
    if (left > arr[i].x)
        left = arr[i].x;
    if (bottom < arr[i].y)
        bottom = arr[i].y;
    if (right < arr[i].x)
        right = arr[i].x;
    if (top > arr[i].y)
        top = arr[i].y;
}

in.x = (int)left;
in.y = (int)top;
in.w = int(right - left);
in.h = int(bottom - top);

return true;

} void ESP::player_rendering(player_t* entity){ if ((entity->dormant())) return;

player_info_t info;
interfaces::engine->get_player_info(entity->index(), &info);

box bbox;
if (!get_playerbox(entity, bbox))
    return;

auto red = variables::ESP::BoxR;
auto green = variables::ESP::BoxG;
auto blue = variables::ESP::BoxB;

if (variables::ESP::BoxESP)
{

    if (variables::ESP::BoxSelect == 0)
    {
        render::draw_outline(bbox.x - 1, bbox.y - 1, bbox.w + 2, bbox.h + 2, color(1, 1, 1, 255));
        render::draw_rect(bbox.x, bbox.y, bbox.w, bbox.h, color(red, green, blue));
        render::draw_outline(bbox.x + 1, bbox.y + 1, bbox.w - 2, bbox.h - 2, color(1, 1, 1, 255));
    }
    else {
        render::draw_corner_box(bbox.x + 1, bbox.y + 1, bbox.w - 2, bbox.h - 2, color(0, 0, 0, 255));
        render::draw_corner_box(bbox.x, bbox.y, bbox.w, bbox.h, color(red, green, blue, 255));
    }
}
if (variables::ESP::HealthESP) {
    box temp(bbox.x - 5, bbox.y + (bbox.h - bbox.h * (utilities::math::clamp_value<int>(entity->health(), 0, 100.f) / 100.f)), 1, bbox.h * (utilities::math::clamp_value<int>(entity->health(), 0, 100) / 100.f) - (entity->health() >= 100 ? 0 : -1));
    box temp_bg(bbox.x - 5, bbox.y, 1, bbox.h);

    auto health_color = color((255 - entity->health() * 2.55), (entity->health() * 2.55), 0, 255);
    std::string healthStr = std::to_string(entity->health());

    if (entity->health() > 100)
        health_color = color(0, 255, 0);

    render::draw_filled_rect(temp_bg.x - 1, temp_bg.y - 1, temp_bg.w + 2, temp_bg.h + 2, color(0, 0, 0, 255));
    render::draw_filled_rect(temp.x, temp.y, temp.w, temp.h, color(health_color));
}
if (variables::ESP::ArmorESP)
{
    box temp(bbox.x, bbox.y + bbox.h + 5, bbox.w * (utilities::math::clamp_value<int>(entity->armor(), 0, 100) / 100.f) - (entity->armor() >= 100 ? 0 : -1), 1);
    box temp_bg(bbox.x, bbox.y + bbox.h + 5, bbox.w, 1);

    render::draw_filled_rect(temp_bg.x - 1, temp_bg.y - 1, temp_bg.w + 2, temp_bg.h + 2, color(1, 1, 1, 255));
    render::draw_filled_rect(temp.x, temp.y, temp.w, temp.h, color(87, 144, 250));

}
if (variables::ESP::NameESP) {
    auto red = variables::ESP::NameR;
    auto green = variables::ESP::NameG;
    auto blue = variables::ESP::NameB;

    std::string print(info.fakeplayer ? std::string("[BOT] ").append(info.name).c_str() : info.name);
    std::transform(print.begin(), print.end(), print.begin(), ::tolower);

    render::text(bbox.x + (bbox.w / 2), bbox.y - 13, render::fonts::watermark_font, print, true, color(red, green, blue, 255));
}
if (variables::ESP::FlagsESP)
{
    std::string Money = std::to_string(entity->money());
    std::string HK = std::to_string(entity->has_heavy_armor());
    std::string Flashed = std::to_string(entity->is_flashed());
    std::string IsDefusing = std::to_string(entity->is_defusing());
    std::string IsScoped = std::to_string(entity->is_scoped());
    int MoneyH = render::get_text_size(render::fonts::watermark_font, "$" + Money).y;
    int HKH = render::get_text_size(render::fonts::watermark_font, HK).y;
    int FlashedH = render::get_text_size(render::fonts::watermark_font, Flashed).y;
    int DefusingH = render::get_text_size(render::fonts::watermark_font, IsDefusing).y;
    int ScopedH = render::get_text_size(render::fonts::watermark_font, IsScoped).y;
    if (entity->has_heavy_armor())
    {
        HK = "HK";
    }
    else {
        HK = "";
        HKH = 0;
    }
    if (entity->is_flashed())
    {
        Flashed = "Flashed";
    }
    else {
        Flashed = "";
        FlashedH = 0;
    }
    if (entity->is_defusing())
    {
        IsDefusing = "Defusing!";
    }
    else {
        IsDefusing = "";
        DefusingH = 0;
    }
    if (entity->is_scoped())
    {
        IsScoped = "Scoped";
    }
    else {
        IsScoped = "";
        ScopedH = 0;
    }
    MoneyH = render::get_text_size(render::fonts::watermark_font, "$" + Money).y;
    HKH = render::get_text_size(render::fonts::watermark_font, HK).y;
    FlashedH = render::get_text_size(render::fonts::watermark_font, Flashed).y;
    DefusingH = render::get_text_size(render::fonts::watermark_font, IsDefusing).y;
    ScopedH = render::get_text_size(render::fonts::watermark_font, IsScoped).y;

    if (entity->health() <= 4)
    {
        render::text(bbox.x + (bbox.w / 2), bbox.y + bbox.h + 10, render::fonts::watermark_font, "Flash Kill", true, color::fadedCherryRed());
    }
    render::text(bbox.x + bbox.w + 5, bbox.y + 2, render::fonts::watermark_font, "$" + Money, false, color(77, 219, 115)); //money
    render::text(bbox.x + bbox.w + 5, bbox.y + 2 + MoneyH + 2, render::fonts::watermark_font, HK, false, color(87, 144, 250)); //hk
    render::text(bbox.x + bbox.w + 5, bbox.y + 2 + MoneyH + 2 + HKH + 2, render::fonts::watermark_font, Flashed, false, color::white()); //flashed
    render::text(bbox.x + bbox.w + 5, bbox.y + 2 + MoneyH + 2 + HKH + 2 + FlashedH + 2, render::fonts::watermark_font, IsDefusing, false, color(250, 129, 125)); //is defusing
    render::text(bbox.x + bbox.w + 5, bbox.y + 2 + MoneyH + 2 + HKH + 2 + FlashedH + 2 + DefusingH + 2, render::fonts::watermark_font, IsScoped, false, color::white()); //is scoped
}

} void ESP::run() { auto local_player = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(interfaces::engine->get_local_player()));

if (!variables::ESP::Enabled)
    return;

if (!local_player)
    return;

for (int i = 1; i <= interfaces::globals->max_clients; i++) {
    auto entity = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(i));

    if (!entity)
        continue;

    if (entity == local_player)
        continue;

    if (entity->health() <= 0)
        continue;

    if (entity->team() == local_player->team() && !variables::ESP::Team)
        continue;

    if (!local_player->can_see_player_pos(entity, entity->get_eye_pos()) && variables::ESP::VisibleOnly)
        continue;

    const int fade = (int)((6.66666666667f * interfaces::globals->frame_time) * 255);

    ESP::player_rendering(entity);
    Visuals::HitMarker();
    //ESP::skeleton(entity);
}

for (int i = 0; i < interfaces::entity_list->get_highest_index(); i++) {
    auto entity = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(i));

    if (entity && entity != local_player) {
        auto client_class = entity->client_class();
        auto model_name = interfaces::model_info->get_model_name(entity->model());
    }
}

}`

features.hpp

namespace ESP { void run(); void player_rendering(player_t* entity); void skeleton(player_t* entity); void healthesp(); void armoresp(); void thirdperson(); }

then in the "MatSystemTopPanel" case

ESP::run();

make sure its above menu render or your esp will render on top of your menu lmao

bardiukz commented 3 years ago

Dude, the "flags esp" is almost painful to see. Use std::vector (or use it with std::pair if you want to include colors) few examples:

std::vector<std::pair<std::string, color>> de_flags;

//enemy has money (if enemy has no money ( $0 ), it wont appear)
if ( cl_ent->money() )
    de_flags.push_back( std::pair<std::string, color>(std::string( "$" ).append( std::to_string( cl_ent->money() ) ), color( 120, 180, 10 ) ) );

//enemy is scoped
if ( cl_ent->is_scoped() )
    de_flags.push_back( std::pair<std::string, color>( std::string( "ZOOM" ), color( 80, 160, 200 ) ) );

//enemy is a bot
if ( info.fakeplayer )
    de_flags.push_back( std::pair<std::string, color>( std::string( "BOT" ), color( 80, 160, 200 ) ) );

//yeah ;(
auto position = 0;

for (auto text : de_flags) 
{

    // x, y, font, text, align ( left, right, center ), color
    g_renderer::text( box.x + box.w + 3, box.y + position, g_renderer::font_flag, text.first, 0, text.second );

    // 🤔 should be using text_height there hehe
    position += 10;

}
YNXModz commented 3 years ago

Dude, the "flags esp" is almost painful to see. Use std::vector (or use it with std::pair if you want to include colors) few examples:

std::vector<std::pair<std::string, color>> de_flags;

//enemy has money (if enemy has no money ( $0 ), it wont appear)
if ( cl_ent->money() )
  de_flags.push_back( std::pair<std::string, color>(std::string( "$" ).append( std::to_string( cl_ent->money() ) ), color( 120, 180, 10 ) ) );

//enemy is scoped
if ( cl_ent->is_scoped() )
  de_flags.push_back( std::pair<std::string, color>( std::string( "ZOOM" ), color( 80, 160, 200 ) ) );

//enemy is a bot
if ( info.fakeplayer )
  de_flags.push_back( std::pair<std::string, color>( std::string( "BOT" ), color( 80, 160, 200 ) ) );

//yeah ;(
auto position = 0;

for (auto text : de_flags) 
{

  // x, y, font, text, align ( left, right, center ), color
  g_renderer::text( box.x + box.w + 3, box.y + position, g_renderer::font_flag, text.first, 0, text.second );

  // 🤔 should be using text_height there hehe
  position += 10;

}

alright will do, the flags esp was rushed tbh and doesnt even work correctly so i will rework it with vector and pair as you said, thanks

fyeol commented 3 years ago

if (!interfaces::debug_overlay->world_to_screen(points[3], flb) || !interfaces::debug_overlay->world_to_screen(points[5], brt) || !interfaces::debug_overlay->world_to_screen(points[0], blb) || !interfaces::debug_overlay->world_to_screen(points[4], frt) || !interfaces::debug_overlay->world_to_screen(points[2], frb) || !interfaces::debug_overlay->world_to_screen(points[1], brb) || !interfaces::debug_overlay->world_to_screen(points[6], blt) || !interfaces::debug_overlay->world_to_screen(points[7], flt)) return false;

u can loop through these in a for loop to not make it ugly...

Mikquaj commented 2 years ago

image can you send "box"?