Just sharing some more of my code in order to enlarge my penis.
may contain derp comments/untidy codenz and some bits removed.
Code:
return 0;
result = *(PDWORD)(result + 0x20);
if(!result)
return 0;
return *(PDWORD)(result + 0x10);
}
void GetName( int index, char* name )
{
CPlayer* tmpc = GetPlayerByIndex( index );
if(tmpc)
sprintf(name, "%s", tmpc->_Name );
else
sprintf(name, "#");
}
bool SameTeam(int i)
{
DWORD ptr = (DWORD)GetPlayerBase( );
BYTE myTeam = *(PBYTE)(2604 * GetMyIndex( ) + 0x5F4 + ptr);
BYTE iTeam = *(PBYTE)(2604 * i + 0x5F4 + ptr);
if(iTeam == myTeam)
return true;
return false;
}
DWORD GetWeaponBase( )
{
DWORD BasePtr = GetBase( );
if(!BasePtr)
return 0;
return *(PDWORD)(BasePtr + 0x44);
}
CPlayer* GetPlayerByIndex(int index)
{
DWORD BasePtr = GetBase( );
if(BasePtr == 0)
return 0;
return *(CPlayer**)(BasePtr + (index * 4) + 4);
}
int GetMyIndex( )
{
CPlayerBase* pPlayerBase = GetPlayerBase( );
if(!pPlayerBase)
return 0;
return pPlayerBase->Index;
}
CPlayer* MyPlayer( )
{
return GetPlayerByIndex( GetMyIndex( ) );
}
};
extern ClassManager pClassManager;
Code:
void Esp(LPDIRECT3DDEVICE9 pDevice)
{
if(!pClassManager.GetBase( ))
return;
CPlayerBase* pBase = pClassManager.GetPlayerBase( );
if(!pBase)
return;
CPlayer *pMyInfo = pClassManager.GetPlayerByIndex( pClassManager.GetMyIndex() );
for(int i = 0; i < 16; i++)
{
if(i == pClassManager.GetMyIndex())
continue;
bool ally = pClassManager.SameTeam(i);
if(opt.esp.oespn && ally)
continue;
CPlayer *pInfo = pClassManager.GetPlayerByIndex(i);
if(pInfo)
{
if(pInfo->health - 625 < 1)
continue;
D3DXVECTOR3 PositionMe( pMyInfo->lx, pMyInfo->ly, pMyInfo->lz);
D3DXVECTOR3 Screen( 0, 0, 0 );
D3DXVECTOR3 Position( pInfo->x2, pInfo->y2, pInfo->z2);
GetScreenCoordFromWorld(pDevice, Position, &Screen);
D3DXVECTOR3 PositionBot( pInfo->x, pInfo->y, pInfo->z);
D3DXVECTOR3 ScreenBot( 0, 0, 0 );
GetScreenCoordFromWorld2(pDevice, PositionBot, &ScreenBot);//just calls D3DXVec3Project without the other shit
float fDistance = Distance(&PositionBot, &PositionMe);
if( Screen.z > 1.0f && ScreenBot.z > 1.0f )
continue;
int boxsize = (int)(ScreenBot.y - Screen.y);
int boxwidth = boxsize/3;
int topleftx = (int)Screen.x - (boxwidth/2);
int toplefty = (int)Screen.y;
CPlayer *pTarget = pClassManager.GetPlayerByIndex(Close);
if()
{
if(aimbot.active && Close == i)
{
DrawBorder( topleftx, toplefty, boxwidth, boxsize, 2, pDevice, 0xFF, 0xFF, 0xFF);
}
else
{
if(ally)
DrawBorder( topleftx, toplefty, boxwidth, boxsize, 2, pDevice, 0x00, 0x00, 0xCD);
else
DrawBorder( topleftx, toplefty, boxwidth, boxsize, 2, pDevice, 0xB2, 0x22, 0x22 );
}
}
if()
{
char Info_Health[30];
sprintf(Info_Health, "[HP: %d]", pInfo->health - 625);
int Health = pInfo->health - 625;
int hboxwidth = 100/3;
int hboxstartx = ScreenBot.x - (hboxwidth/2);
int hboxstarty = ScreenBot.y + 4;
int percentOfWidth
//Menu.font->DrawText(Screen.x, Screen.y - 3, 0xFFFFFFFF, Info_Health, DT_CENTER );
}
if(esp.espi)
{
Menu.font->DrawText(Screen.x, Screen.y - 10, 0xFFFFFFFF, pInfo->_Name, DT_CENTER );
}
else if()
{
char Info_D[255];
sprintf(Info_D, "[%dF]", (int)fDistance / 10);;
Menu.font->DrawText(Screen.x, Screen.y - 24, 0xFFFFFFFF, Info_D, DT_CENTER );
}
else if()
{
char Info_D[255];
sprintf(Info_D, "%s [%dF]", pInfo->_Name, (int)fDistance / 10);
Menu.font->DrawText(Screen.x, Screen.y - 24, 0xFFFFFFFF, Info_D, DT_CENTER );
}
}
}
}