designer1337 / csgo-cheat-base

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

base esp #46

Open reaperpaster opened 4 years ago

reaperpaster commented 4 years ago

would be cool if you could add a basic esp to the base like a simple box esp

bruhmoment21 commented 4 years ago
//esp.hpp
#pragma once
#include "../../../dependencies/common_includes.hpp"

namespace visuals
{
    void run() noexcept;
    void boxes(player_t* entity) noexcept;
}

struct box
{
    int x, y, w, h;
    box() = default;
    box(const int x, const int y, const int w, const int h)
    {
        this->x = x;
        this->y = y;
        this->w = w;
        this->h = h;
    }
};
//esp.cpp
bool get_playerbox(player_t* ent, box& in)
{
    vec3_t flb, brt, blb, frt, frb, brb, blt, flt;

    const auto origin = ent->abs_origin();
    const auto min = ent->collideable()->mins() + origin;
    const auto 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 };

    float left = flb.x;
    float top = flb.y;
    float right = flb.x;
    float 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 = static_cast<int>(left);
    in.y = static_cast<int>(top);
    in.w = static_cast<int>(right - left);
    in.h = static_cast<int>(bottom - top);

    return true;
}

const color history{ 255, 255, 255,50 };
const color history_outline{ 0,0,0,60 };

void visuals::run() noexcept
{
    for (int i = 1; i <= interfaces::engine->max_clients(); ++i)
    {
        auto* const entity = static_cast<player_t*>(interfaces::entity_list->get_client_entity(i));
        if (!entity || !csgo::local_player || entity == csgo::local_player || entity->health() <= 0 /*|| entity->dormant()*/) continue;
        if (!cfg_sys.sets.teammates && entity->team() == csgo::local_player->team()) continue;

        boxes(entity);
    }
}

void visuals::boxes(player_t* entity) noexcept
{
    box bbox;
    if (!cfg_sys.sets.boxes || !get_playerbox(entity, bbox)) return;

    render::rect(bbox.x, bbox.y, bbox.w, bbox.h, entity->dormant() ? history : cfg_sys.sets.boxes_color);
    render::rect(bbox.x + 1, bbox.y + 1, bbox.w - 2, bbox.h - 2, entity->dormant() ? history_outline : color(0, 0, 0));
    render::rect(bbox.x - 1, bbox.y - 1, bbox.w + 2, bbox.h + 2, entity->dormant() ? history_outline : color(0, 0, 0));
}
//this is in paint traverse. hooks.cpp
case fnv::hash("MatSystemTopPanel"): {
        if (interfaces::engine->is_in_game() && interfaces::engine->is_connected()) // make these
            visuals::run(); // 2 lines first

        // rest of the code

        break;
    }
reaperpaster commented 4 years ago

thank you, one more thing: the sdk doesn't have the max_clients() thing I think, I don't found it at least

reaperpaster commented 4 years ago

nvm i found it in global vars im just not sure if works

designer1337 commented 4 years ago

It does interfaces::globals->max_clients;

reaperpaster commented 4 years ago

ok ty guys

bruhmoment21 commented 4 years ago

use csgo::local_player instead of auto* const local_player = static_cast<player_t*>(interfaces::entity_list->get_client_entity(interfaces::engine->get_local_player()));

danyrusdem commented 4 years ago

void visuals::healthesp()
{
    if (!variables::healthesp)
        return;
    if (!interfaces::engine->is_connected() || !interfaces::engine->is_in_game())
        return;
    if (!csgo::local_player)
        return;

    for (int iPlayer = 0; iPlayer < interfaces::globals->max_clients; iPlayer++)
    {
        auto pCSPlayer = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(iPlayer));
        if (!pCSPlayer)
            continue;
        if (pCSPlayer == csgo::local_player)
            continue;
        if (pCSPlayer->dormant())
            continue;
        if (!(pCSPlayer->is_alive() && pCSPlayer->health() > 0))
            continue;

        vec3_t vecFoot, vecScreen, vecHeadScreen;
        vecFoot = pCSPlayer->origin();
        if (!(math::world_to_screen(vecFoot, vecScreen)))
            continue;

        vecFoot.z += 72.f;
        if (!(math::world_to_screen(vecFoot, vecHeadScreen)))
            continue;

        auto health = pCSPlayer->health();
        int h = vecScreen.y - vecHeadScreen.y;
        //render::draw_text_string(10, 20, render::fonts::watermark_font, std::to_string(h), true, color::red());
        int healthheight = (h * health) / 100;
        int w = 4;
        int y = vecHeadScreen.y;
        int x = vecHeadScreen.x - (h / 4 + 5);
        if (pCSPlayer->team() == csgo::local_player->team() && variables::showteamesp)
        {
            render::draw_rect(x, y, w, h, color::black());
            render::draw_filled_rect(x + 1, y + 1, w - 1, healthheight - 2, color::green());
        }
        else if (pCSPlayer->team() != csgo::local_player->team())
        {
            render::draw_rect(x, y, w, h, color::black());
            render::draw_filled_rect(x + 1, y + 1, w - 1, healthheight - 2, color::green());
        }
    }
}
danyrusdem commented 4 years ago
//armorbar
void visuals::armoresp()
{
    if (!variables::armoresp)
        return;
    if (!interfaces::engine->is_connected() || !interfaces::engine->is_in_game())
        return;
    if (!csgo::local_player)
        return;

    for (int iPlayer = 0; iPlayer < interfaces::globals->max_clients; iPlayer++)
    {
        auto pCSPlayer = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(iPlayer));
        if (!pCSPlayer)
            continue;
        if (pCSPlayer == csgo::local_player)
            continue;
        if (pCSPlayer->dormant())
            continue;
        if (!(pCSPlayer->is_alive() && pCSPlayer->health() > 0))
            continue;

        vec3_t vecFoot, vecScreen, vecHeadScreen;
        vecFoot = pCSPlayer->origin();
        if (!(math::world_to_screen(vecFoot, vecScreen)))
            continue;

        vecFoot.z += 72.f;
        if (!(math::world_to_screen(vecFoot, vecHeadScreen)))
            continue;

        auto armor = pCSPlayer->armor();
        int h = vecScreen.y - vecHeadScreen.y;
        //render::draw_text_string(10, 20, render::fonts::watermark_font, std::to_string(h), true, color::red());
        int healthheight = (h * armor) / 100;
        int w = 4;
        int y = vecHeadScreen.y;
        int x = vecHeadScreen.x + (h / 4);
        if (pCSPlayer->team() == csgo::local_player->team() && variables::showteamesp)
        {
            render::draw_rect(x, y, w, h, color::black());
            render::draw_filled_rect(x + 1, y + 1, w - 1, healthheight - 2, color::blue());
        }
        else if (pCSPlayer->team() != csgo::local_player->team())
        {
            render::draw_rect(x, y, w, h, color::black());
            render::draw_filled_rect(x + 1, y + 1, w - 1, healthheight - 2, color::blue());
        }
    }
}
danyrusdem commented 4 years ago
//bone esp
void visuals::boneesp()
{
    if (!variables::boneesp)
        return;
    if (!interfaces::engine->is_connected() || !interfaces::engine->is_in_game())
        return;
    if (!csgo::local_player)
        return;

    for (int iPlayer = 0; iPlayer < interfaces::globals->max_clients; iPlayer++)
    {
        auto pCSPlayer = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(iPlayer));
        if (!pCSPlayer)
            continue;
        if (pCSPlayer == csgo::local_player)
            continue;
        if (pCSPlayer->dormant())
            continue;
        if (!(pCSPlayer->is_alive() && pCSPlayer->health() > 0))
            continue;

        auto pStudioModel = interfaces::model_info->get_studio_model(pCSPlayer->model());
        if (!pStudioModel)
            return;

        static matrix_t pBoneToWorldOut[128];
        if (pCSPlayer->setup_bones(pBoneToWorldOut, 128, 256, 0))
        {
            for (int i = 0; i < pStudioModel->bones_count; i++)
            {
                studio_bone_t* pBone = pStudioModel->bone(i);
                if (!pBone || !(pBone->flags & 256) || pBone->parent == -1)
                    continue;

                vec3_t vBonePos1;
                if (!math::world_to_screen(vec3_t(pBoneToWorldOut[i][0][3], pBoneToWorldOut[i][1][3], pBoneToWorldOut[i][2][3]), vBonePos1))
                    continue;

                vec3_t vBonePos2;
                if (!math::world_to_screen(vec3_t(pBoneToWorldOut[pBone->parent][0][3], pBoneToWorldOut[pBone->parent][1][3], pBoneToWorldOut[pBone->parent][2][3]), vBonePos2))
                    continue;
                if (pCSPlayer->team() == csgo::local_player->team() && variables::showteamesp)
                {
                    render::draw_line(vBonePos1.x, vBonePos1.y, vBonePos2.x, vBonePos2.y, color::white());
                }
                else if (pCSPlayer->team() != csgo::local_player->team())
                {
                    render::draw_line(vBonePos1.x, vBonePos1.y, vBonePos2.x, vBonePos2.y, color::white());
                }
            }
        }
    }
}
danyrusdem commented 4 years ago
//nameesp
void visuals::nameesp()
{
    if (!variables::nameesp)
        return;
    if (!interfaces::engine->is_connected() || !interfaces::engine->is_in_game())
        return;
    if (!csgo::local_player)
        return;

    for (int iPlayer = 0; iPlayer < interfaces::globals->max_clients; iPlayer++)
    {
        auto pCSPlayer = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(iPlayer));
        if (!pCSPlayer)
            continue;
        if (pCSPlayer == csgo::local_player)
            continue;
        if (pCSPlayer->dormant())
            continue;
        if (!(pCSPlayer->is_alive() && pCSPlayer->health() > 0))
            continue;

        vec3_t vecHead, vecHeadScreen;
        vecHead = pCSPlayer->get_bone_position(8);
        vecHead.z += 20.f;
        if (!(math::world_to_screen(vecHead, vecHeadScreen)))
            continue;

        player_info_t playerinfo;
        interfaces::engine->get_player_info(iPlayer, &playerinfo);

        if (pCSPlayer->team() == csgo::local_player->team() && variables::showteamesp)
        {
            render::text(vecHeadScreen.x, vecHeadScreen.y, render::fonts::watermark_font, playerinfo.name, true, color::blue());
        }
        else if (pCSPlayer->team() != csgo::local_player->team())
        {
            render::text(vecHeadScreen.x, vecHeadScreen.y, render::fonts::watermark_font, playerinfo.name, true, color::red());
        }
    }
}
fartnuggets420 commented 3 years ago

esp is crashing tryed debugging no info why

danyrusdem commented 3 years ago

Look at date of this esp

чт, 10 сент. 2020 г., 18:47 fartnuggets420 notifications@github.com:

esp is crashing tryed debugging no info why

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/designer1337/csgo-cheat-base/issues/46#issuecomment-690383339, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7NEARDCCKSEUPQTKKPJWDSFDYJPANCNFSM4OITBDUQ .

pparadoxx commented 3 years ago

if (!(math::world_to_screen(vecHead, vecHeadScreen)))

this is giving me an error, why?

danyrusdem commented 3 years ago

idk

сб, 26 сент. 2020 г. в 05:52, pparadoxx notifications@github.com:

if (!(math::world_to_screen(vecHead, vecHeadScreen)))

this is giving me an error, why?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/designer1337/csgo-cheat-base/issues/46#issuecomment-699283421, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7NEAUKPB43ALZWKIT2TJ3SHVJNTANCNFSM4OITBDUQ .

iraizo commented 3 years ago

if (!(math::world_to_screen(vecHead, vecHeadScreen)))

this is giving me an error, why?

it would be helpful saying which error

danyrusdem commented 3 years ago

I don't know why u have error,maybe u have another world2screen or anything else

вс, 27 сент. 2020 г., 00:02 raizo notifications@github.com:

if (!(math::world_to_screen(vecHead, vecHeadScreen)))

this is giving me an error, why?

it would be helpful saying which error

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/designer1337/csgo-cheat-base/issues/46#issuecomment-699547430, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7NEATBR4I7UO2YOR52PALSHZJEXANCNFSM4OITBDUQ .

iraizo commented 3 years ago

I don't know why u have error,maybe u have another world2screen or anything else вс, 27 сент. 2020 г., 00:02 raizo notifications@github.com: if (!(math::world_to_screen(vecHead, vecHeadScreen))) this is giving me an error, why? it would be helpful saying which error — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#46 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7NEATBR4I7UO2YOR52PALSHZJEXANCNFSM4OITBDUQ .

why even comment in the first place if you dont know what the issue is

pparadoxx commented 3 years ago

nah i found it out, the cheat updated math.cpp so i'm using the older one

JerryBOT-CSGO commented 3 years ago

For people who want thee solution :

bool math::world_to_screen(const vec3_t & origin, vec3_t & screen) { - math.cpp bool world_to_screen(const vec3_t& origin, vec3_t& screen); - math.hpp

or just spend time here learncpp.com :)

iraizo commented 3 years ago

@JerryBOT-CSGO what fucking solution; it has been answered already.

JerryBOT-CSGO commented 3 years ago

@JerryBOT-CSGO what fucking solution; it has been answered already.

for fucking retards koff koff @vibingdir

iraizo commented 3 years ago

@JerryBOT-CSGO what fucking solution; it has been answered already.

for fucking retards koff koff @vibingdir

retards can still read.

vibingdir commented 3 years ago

@JerryBOT-CSGO what fucking solution; it has been answered already.

for fucking retards koff koff @vibingdir

?? I haven’t been in this conversation in months why am I being tagged

iraizo commented 3 years ago

no clue.