
Originally Posted by
z346etn56jzd7egth
The world vector is still uninitialized and either way, that if statement is completely useless.
as for your issue, maybe try removing that LifeState check, I use Health to check if the player is alive so idk if that could be the cause or not.
Health has nothing to do on if its rendering considering its affected by where im aiming
See it draws if im looking this way..

Yet not if i look this way...

Code (rewrote function by looking at lua happens to be almost the same lol)
Code:
void CDrawManager::DrawPlayerBox(C_BasePlayer *pEnt, DWORD dwColor)
{
if (pEnt == NULL)
return;
Vector vMon, vNom;
vNom = pEnt->GetAbsOrigin();
vMon = vNom + Vector(0, 0, 80.f);
Vector vBot, vTop;
if (WorldToScreen(vNom, vBot) && WorldToScreen(vMon, vTop))
{
int iH = (vBot.y - vTop.y);
int iW = iH / 5.f;
OutlineRect(vTop.x - iW, vTop.y, iW * 2, iH, dwColor);
}
}
w2s
Code:
bool CDrawManager::WorldToScreen(Vector &vOrigin, Vector &vScreen)
{
const VMatrix& worldToScreen = g_pEngine->WorldToScreenMatrix();
float w = 0;
w = w + worldToScreen[3][0] * vOrigin[0];
w = w + worldToScreen[3][1] * vOrigin[1];
w = w + worldToScreen[3][2] * vOrigin[2] + worldToScreen[3][3];
vScreen.z = 0;
if (w > 0.001)
{
float fl1DBw = 1 / w;
vScreen.x = (gScreenWidth / 2) + (0.5 * ((worldToScreen[0][0] * vOrigin[0] + worldToScreen[0][1] * vOrigin[1] + worldToScreen[0][2] * vOrigin[2] + worldToScreen[0][3]) * fl1DBw) * gScreenWidth + 0.5);
vScreen.y = (gScreenHeight / 2) - (0.5 * ((worldToScreen[1][0] * vOrigin[0] + worldToScreen[1][1] * vOrigin[1] + worldToScreen[1][2] * vOrigin[2] + worldToScreen[1][3]) * fl1DBw) * gScreenHeight + 0.5);
return true;
}
return false;
}
nvm i removed that fucking pointless check on 2 uninitialized variables and it works now... i didn't pay attention to that part of my code hahaha