HRESULT DoEsp(LPDIRECT3DDEVICE9 pDevice)
{
for(int player_ = 0; player_ < 32; player_++)
{
if(!g_pBase->player || !g_pBase->local) break;
CPlayerInfo* player_info = GetPlayerInfoByIndex(player_);
CPlayerInfo* local_info = GetPlayerInfoByIndex(g_pBase->local->index);
CPlayer* pPlayer = g_pBase->player[player_];
if(player_info && pPlayer)
{
float fPlayer[3] = {0};
fPlayer[0] = pPlayer->read_coordinate.x;
fPlayer[1] = pPlayer->read_coordinate.y + 35;
fPlayer[2] = pPlayer->read_coordinate.z;
int x = 0, y = 0, z = 0;
DWORD EspColor;
if(WorldToScreen(pDevice, fPlayer, x, y))
{
if(player_info->m_Health > 0 && player_ != g_pBase->local->index)
{
if(cVars.Esp.Name) {y += 13;g_pFont->DrawTextA(x,y,EspColor,player_info->m_IngameNick,D3DFONT_CENTERED);}
}
}
}
}
return D3D_OK;
}