csgo-cheat-base icon indicating copy to clipboard operation
csgo-cheat-base copied to clipboard

base esp

Open reaperpaster opened this issue 4 years ago • 24 comments

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

reaperpaster avatar Jun 25 '20 17:06 reaperpaster

//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;
	}

bruhmoment21 avatar Jun 25 '20 17:06 bruhmoment21

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

reaperpaster avatar Jun 25 '20 18:06 reaperpaster

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

reaperpaster avatar Jun 25 '20 18:06 reaperpaster

It does interfaces::globals->max_clients;

designer1337 avatar Jun 25 '20 18:06 designer1337

ok ty guys

reaperpaster avatar Jun 25 '20 18:06 reaperpaster

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()));

bruhmoment21 avatar Jun 26 '20 06:06 bruhmoment21

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 avatar Jul 10 '20 11:07 danyrusdem

//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 avatar Jul 10 '20 12:07 danyrusdem

//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 avatar Jul 10 '20 13:07 danyrusdem

//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());
		}
	}
}

danyrusdem avatar Jul 10 '20 13:07 danyrusdem

esp is crashing tryed debugging no info why

fartnuggets420 avatar Sep 10 '20 15:09 fartnuggets420

Look at date of this esp

чт, 10 сент. 2020 г., 18:47 fartnuggets420 [email protected]:

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 .

danyrusdem avatar Sep 10 '20 17:09 danyrusdem

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

this is giving me an error, why?

pparadoxx avatar Sep 26 '20 02:09 pparadoxx

idk

сб, 26 сент. 2020 г. в 05:52, pparadoxx [email protected]:

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 .

danyrusdem avatar Sep 26 '20 10:09 danyrusdem

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

this is giving me an error, why?

it would be helpful saying which error

iraizo avatar Sep 26 '20 21:09 iraizo

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

вс, 27 сент. 2020 г., 00:02 raizo [email protected]:

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 .

danyrusdem avatar Sep 26 '20 21:09 danyrusdem

I don't know why u have error,maybe u have another world2screen or anything else вс, 27 сент. 2020 г., 00:02 raizo [email protected]: 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

iraizo avatar Sep 26 '20 23:09 iraizo

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

pparadoxx avatar Sep 27 '20 20:09 pparadoxx

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 :)

JerryBOT-CSGO avatar Dec 07 '20 20:12 JerryBOT-CSGO

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

iraizo avatar Dec 07 '20 20:12 iraizo

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

for fucking retards koff koff @vibingdir

JerryBOT-CSGO avatar Dec 07 '20 21:12 JerryBOT-CSGO

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

for fucking retards koff koff @vibingdir

retards can still read.

iraizo avatar Dec 07 '20 21:12 iraizo

@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

vibingdir avatar Dec 07 '20 21:12 vibingdir

no clue.

iraizo avatar Dec 07 '20 21:12 iraizo