clang-format, add to menu and other changes
This commit is contained in:
parent
9b5073bbfa
commit
62ec2a8e56
@ -7,57 +7,61 @@ namespace shared
|
||||
namespace lightesp
|
||||
{
|
||||
|
||||
|
||||
CatVar enable(CV_SWITCH, "lightesp", "0", "Enable LightESP",
|
||||
CatVar enable(CV_SWITCH, "lightesp_enabled", "0", "Enable LightESP",
|
||||
"Lightweight ESP. Only shows head.");
|
||||
Vector hitp[32];
|
||||
Vector minp[32];
|
||||
Vector maxp[32];
|
||||
bool drawEsp[32];
|
||||
|
||||
void run() {
|
||||
void run()
|
||||
{
|
||||
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
|
||||
{
|
||||
CachedEntity *pEntity = ENTITY(i);
|
||||
if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer()) {
|
||||
hitp[i] = {0, 0, 0};
|
||||
if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer())
|
||||
{
|
||||
drawEsp[i] = false;
|
||||
continue;
|
||||
}
|
||||
if (pEntity->m_iTeam() == LOCAL_E->m_iTeam() && playerlist::IsDefault(pEntity)) {
|
||||
hitp[i] = {0, 0, 0};
|
||||
if (pEntity->m_iTeam() == LOCAL_E->m_iTeam() &&
|
||||
playerlist::IsDefault(pEntity))
|
||||
{
|
||||
drawEsp[i] = false;
|
||||
continue;
|
||||
}
|
||||
if (!pEntity->hitboxes.GetHitbox(0))
|
||||
continue;
|
||||
hitp[i] = pEntity->hitboxes.GetHitbox(0)->center;
|
||||
minp[i] = pEntity->hitboxes.GetHitbox(0)->min;
|
||||
maxp[i] = pEntity->hitboxes.GetHitbox(0)->max;
|
||||
hitp[i] = pEntity->hitboxes.GetHitbox(0)->center;
|
||||
minp[i] = pEntity->hitboxes.GetHitbox(0)->min;
|
||||
maxp[i] = pEntity->hitboxes.GetHitbox(0)->max;
|
||||
drawEsp[i] = true;
|
||||
}
|
||||
}
|
||||
void draw() {
|
||||
#if ENABLE_VISUALS
|
||||
void draw()
|
||||
{
|
||||
#if ENABLE_VISUALS
|
||||
if (!enable)
|
||||
return;
|
||||
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) {
|
||||
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
|
||||
{
|
||||
if (!drawEsp[i])
|
||||
continue;
|
||||
CachedEntity *pEntity = ENTITY(i);
|
||||
if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer())
|
||||
continue;
|
||||
auto hitboxpos = hitp[i];
|
||||
auto min = minp[i];
|
||||
auto max = maxp[i];
|
||||
|
||||
if (!hitboxpos.x && !hitboxpos.y && !hitboxpos.z)
|
||||
continue;
|
||||
Vector out;
|
||||
if (draw::WorldToScreen(hitboxpos, out))
|
||||
if (draw::WorldToScreen(hitp[i], out))
|
||||
{
|
||||
float size = 0.0f;
|
||||
if (abs(max.x - min.x) > abs(max.y - min.y))
|
||||
size = abs(max.x - min.x);
|
||||
float size;
|
||||
if (abs(maxp[i].x - minp[i].x) > abs(maxp[i].y - minp[i].y))
|
||||
size = abs(maxp[i].x - minp[i].x);
|
||||
else
|
||||
size = abs(max.y - min.y);
|
||||
size = abs(maxp[i].y - minp[i].y);
|
||||
|
||||
draw_api::draw_rect(out.x, out.y, size / 4, size / 4,
|
||||
hacks::shared::lightesp::LightESPColor(pEntity)); //hacks::shared::lightesp::LightESPColor(pEntity)
|
||||
draw_api::draw_rect(
|
||||
out.x, out.y, size / 4, size / 4,
|
||||
hacks::shared::lightesp::LightESPColor(pEntity));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -65,9 +69,12 @@ void draw() {
|
||||
|
||||
rgba_t LightESPColor(CachedEntity *ent)
|
||||
{
|
||||
if (!playerlist::IsDefault(ent)) {
|
||||
if (!playerlist::IsDefault(ent))
|
||||
{
|
||||
return playerlist::Color(ent);
|
||||
}
|
||||
return colors::green;
|
||||
}
|
||||
}}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,6 +198,10 @@ static const std::string list_hl2dm = R"(
|
||||
"glow_medkits"
|
||||
"glow_ammo"
|
||||
]
|
||||
"LightESP" [
|
||||
"LightESP Menu"
|
||||
"lightesp_enabled"
|
||||
]
|
||||
"GUI" [
|
||||
"GUI Settings"
|
||||
"logo"
|
||||
|
Reference in New Issue
Block a user