Decided to share some code with beginner programmers. Here is not the complete project, but only a part of functions - for ESP.
In my cheat, I have three types of ESP:
1)Display the names of Enemys
2)Show healthbar.
3)draw lines from the center of the screen to the enemy.
WARNING - address in this code - only for RU CF! UPDATE IT FOR YOUR LOCALIZATION! IT'S CODE NOT FOR C+P
Code:
DWORD PlayerClient = *(DWORD*)(ClientShell+0x54);
if(PlayerClient!=NULL)
{
if(GetMeIdxInPlayerInfoList==NULL)
{
GetMeIdxInPlayerInfoList = (lpGetMeIdxInPlayerInfoList) (CShell + (0x1FD70));//this function return my player index
}
int drawcount=0;
CPlayer *me = (CPlayer*)((ClientShell + (0x743C+4))+ (GetMeIdxInPlayerInfoList(ClientShell) * 0x4c8));//this is my player
char szFormat[256];
for(int i=0;i<16;i++)//array of players
{
CPlayer * pPlayerInfo = (CPlayer*)((ClientShell + (0x743C+4))+ (i * 0x4c8));
if(strlen(pPlayerInfo->Name)>2 && pPlayerInfo->Team!=me->Team)//if player have name and his Enemy
{
drawcount++;
if(pPlayerInfo->Health>0)//If Enemy Alive
{
sprintf(szFormat,"%s",pPlayerInfo->Name);
D3DXVECTOR3 pos;
if(WorldToScreen(pDevice,pPlayerInfo->Object->Head,&pos))//If visible in My Screen
{
if(hack1>=1)//first type ESP
{
WriteText(szFormat,pos.x,pos.y,Red);//Draw Enemy Name
if(pPlayerInfo->Has_C4)
{
sprintf(szFormat,"%s","C4");
WriteText(szFormat,pos.x,pos.y+15+15,Red);//Draw what Enemy have C4
}
}
if(hack1>=2)//second ESP type
{
if(pPlayerInfo->Health>=90)//enemy health is very good
{
DrawHealthBar(pos.x,pos.y+15,30,5,Green,Black,pPlayerInfo->Health,100,pDevice);
}
else if(pPlayerInfo->Health>=40)//enemy health is not good
{
DrawHealthBar(pos.x,pos.y+15,30,5,Yellow,Black,pPlayerInfo->Health,100,pDevice);
}
else //enemy health - very bad, you can kill him very easy :)
{
DrawHealthBar(pos.x,pos.y+15,30,5,Red,Black,pPlayerInfo->Health,100,pDevice);
}
}
int ScreenCenterX = GetSystemMetrics(0) / 2;
int ScreenCenterY = GetSystemMetrics(1) / 2;
if(hack1>=3)// DrawLines from center screen to Enemy
{
DrawLine(ScreenCenterX,ScreenCenterY,pos.x,pos.y,1,Blue,pDevice);
}
}
}
}
}
}
What you need for this code:
Code:
void DrawHealthBar(int x, int y, int w, int h, D3DCOLOR color, D3DCOLOR BorderColor, int hp, int maxhp,LPDIRECT3DDEVICE9 g_pDevice)
{
FillRGB(x, y, ( hp / (double)maxhp ) * w, h, color, g_pDevice);
DrawBorder(x, y, w, h, BorderColor, g_pDevice);
}
bool WorldToScreen(LPDIRECT3DDEVICE9 pDev, D3DXVECTOR3 vWorld, D3DXVECTOR3* Pos)
{
D3DVIEWPORT9 viewPort = {0};
D3DXMATRIX projection, view, world;
pDev->GetTransform(D3DTS_VIEW, &view);
pDev->GetTransform(D3DTS_PROJECTION, &projection);
pDev->GetTransform(D3DTS_WORLD, &world);
pDev->GetViewport(&viewPort);
D3DXVec3Project(Pos, &vWorld, &viewPort, &projection, &view, &world);
if(Pos->z < 1)
{
return true;
}
return false;
}
ID3DXLine *pLine = NULL;
void DrawLine(float x, float y, float x2, float y2, float width, D3DCOLOR color, LPDIRECT3DDEVICE9 pDevice)
{
if(pLine==NULL)
{
D3DXCreateLine( pDevice, &pLine);
}
D3DXVECTOR2 vLine[2];
pLine->SetWidth( width );
pLine->SetAntialias( false );
pLine->SetGLLines( true );
vLine[0].x = x;
vLine[0].y = y;
vLine[1].x = x2;
vLine[1].y = y2;
pLine->Begin();
pLine->Draw( vLine, 2, color );
pLine->End();
}
and some classes:
Code:
struct cObject
{
char spacer00[0x4];
D3DXVECTOR3 Origin;
D3DXVECTOR3 Head;
};
struct UnkStruct
{
float Pitch;
float Yaw;
char spacer00[0xC6];
bool IsDead;
char spacer01[0x1647];
unsigned char CurrentGun;
char spacer02[0x3];
bool IsMutant;
};
struct CPlayer
{
// char spacer00[0x8];
cObject* Object;
char ClientID;
char Team;
char Name[12];
char spacer01[0x2];
UnkStruct *unk;
int PlayerSlotTeam;
int unkstruct1;
bool Has_C4;
int State;
int Rank;
int unkstruct2;
int unkstruct3;
short Health;
short Kills;
};
How find address for ESP? Its simple - run game with bypass (or use special LoadLib program), attach to game with OllyDbg.
Select
"Cshell.dll" module, and use this string for binary scan:
"56 8B F1 0F B6 86 ?? ?? ?? ?? 50 E8 ?? ?? ?? ?? 83 C4 04"
after that u see function with desired offsets. use function prototype:
Code:
typedef int (__thiscall *lpGetMeIdxInPlayerInfoList)(unsigned long ulCLTClientShell);
lpGetMeIdxInPlayerInfoList GetMeIdxInPlayerInfoList;
update desired offsets or use this
log
Enjoy!

Sorry for my English.
Credits: luizimloko &~FALLEN~
can I have someone forgot to add in the credits?
