ESP not working properly
Hey Guys,
recently i switched from doing external to internal, i hooked everything i need and everything works fine, except my ESP.
As you can see in this gif, my cheat gets everything fine but every ~0.2 sec it freaks out and draws the Box of the player and the snapline elsewhere.
On the left i Print out the ViewMatrix, as you can see the Values change here and there(even if i stand still). I dont know what is wrong with it, my external works just fine.
the weird thing is that if i tab out of the game(mouse is not hovering over csgo) it works fine, no values change...

This is my code:
ESP Loop:
World to screen function: (yeah i know its a public source)
Screen transform:
and this is how i get my ViewMatrix
i appreciate any help. Im still learning
If you need more code tell me
EDIT: ViewMatrix Values are changing to 0
recently i switched from doing external to internal, i hooked everything i need and everything works fine, except my ESP.
As you can see in this gif, my cheat gets everything fine but every ~0.2 sec it freaks out and draws the Box of the player and the snapline elsewhere.
On the left i Print out the ViewMatrix, as you can see the Values change here and there(even if i stand still). I dont know what is wrong with it, my external works just fine.
the weird thing is that if i tab out of the game(mouse is not hovering over csgo) it works fine, no values change...

This is my code:
ESP Loop:
Code:
for (int i = 1; i < g_EntityList->GetHighestEntityIndex(); i++)
{
C_BaseEntity *entity = g_EntityList->GetClientEntity(i);
C_BaseEntity *local = g_EntityList->GetClientEntity(g_EngineClient->GetLocalPlayer());
auto ent = C_BasePlayer::GetPlayerByIndex(i);
if (entity == nullptr)
continue;
if (entity->IsDormant())
continue;
if (!ent->IsAlive())
continue;
if (!local)
continue;
if (entity->m_iTeamNum() != local->m_iTeamNum())
{
Vector pos, pos3D;
pos3D = entity->m_vecOrigin();
if (!Math::WorldToScreen(pos3D, pos))
continue;
bool PVS = true;
RECT rect = DynamicBox(entity, PVS, local);
Draw->DrawBox(rect.left-0.5, rect.top-0.5, rect.right - rect.left+1, rect.bottom - rect.top+1, 1, 0, 0, 0, 255);
Draw->DrawBox(rect.left + 0.5, rect.top + 0.5, rect.right - rect.left - 1, rect.bottom - rect.top - 1, 1, 0, 0, 0, 255);
Draw->DrawBox(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 1, 255, 0, 0, 255);
}
}
Code:
bool WorldToScreen(const Vector& in, Vector& out)
{
if(screen_transform(in, out)) {
g_EngineClient->GetScreenSize(w, h);
out.x = (w / 2.0f) + (out.x * w) / 2.0f;
out.y = (h / 2.0f) - (out.y * h) / 2.0f;
return true;
}
return false;
}
Code:
static bool screen_transform(const Vector& in, Vector& out)
{
static auto& w2sMatrix = g_EngineClient->WorldToScreenMatrix();
out.x = w2sMatrix.m[0][0] * in.x + w2sMatrix.m[0][1] * in.y + w2sMatrix.m[0][2] * in.z + w2sMatrix.m[0][3];
out.y = w2sMatrix.m[1][0] * in.x + w2sMatrix.m[1][1] * in.y + w2sMatrix.m[1][2] * in.z + w2sMatrix.m[1][3];
out.z = 0.0f;
float w = w2sMatrix.m[3][0] * in.x + w2sMatrix.m[3][1] * in.y + w2sMatrix.m[3][2] * in.z + w2sMatrix.m[3][3];
if(w < 0.001f) {
return false;
}
out.x /= w;
out.y /= w;
return true;
}
Code:
const matrix3x4& WorldToScreenMatrix()
{
typedef const matrix3x4& (__thiscall* oWorldToScreenMatrix)(PVOID);
return call_vfunc< oWorldToScreenMatrix >(this, 37)(this);
}
If you need more code tell me
EDIT: ViewMatrix Values are changing to 0