Fix lightesp performance and add option to disable lightesp

This commit is contained in:
TotallyNotElite 2018-06-10 14:21:27 +02:00
parent c374acbee9
commit 4735118809

View File

@ -8,19 +8,20 @@ namespace lightesp
{ {
CatVar enable(CV_SWITCH, "backtrack", "0", "Enable backtrack", CatVar enable(CV_SWITCH, "lightesp", "0", "Enable LightESP",
"For legit play only as of right now."); "Lightweight ESP. Only shows head.");
Vector hitp[256]; Vector hitp[32];
Vector minp[256]; Vector minp[32];
Vector maxp[256]; Vector maxp[32];
void run() { void run() {
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *pEntity = ENTITY(i); CachedEntity *pEntity = ENTITY(i);
if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer()) if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer()) {
hitp[i] = {0, 0, 0}; hitp[i] = {0, 0, 0};
continue; continue;
}
if (pEntity->m_iTeam() == LOCAL_E->m_iTeam()) if (pEntity->m_iTeam() == LOCAL_E->m_iTeam())
continue; continue;
if (pEntity->m_Type() != ENTITY_PLAYER) if (pEntity->m_Type() != ENTITY_PLAYER)
@ -37,6 +38,8 @@ void run() {
} }
void draw() { void draw() {
#if ENABLE_VISUALS #if ENABLE_VISUALS
if (!enable)
return;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) { for (int i = 1; i < g_IEngine->GetMaxClients(); i++) {
auto hitboxpos = hitp[i]; auto hitboxpos = hitp[i];
auto min = minp[i]; auto min = minp[i];