In the code see you the errors in RED and idk what is wroing can pls one this FIX?? i give Crediz
Code:
bool WorldToScreen(LPDIRECT3DDEVICE9 pDev, CPlayer* pPlayer, D3DXVECTOR3* Pos)
{
D3DXVECTOR3 vWorld(pPlayer->Object->x ,pPlayer->Object->y, pPlayer->Object->z);
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;
}
void ESP(LPDIRECT3DDEVICE9 pDevice)
{
DWORD CShellBase = (DWORD)GetModuleHandleA("CShell.dll");
unsigned long Base = *(DWORD*)(CShellBase + 0x30FB7C);
char *szFormat = new char[ 256 ];
if(Base != 0)
{
for(int i = 0; i < 16; i++)
{
DWORD dwStruct = (Base + (i * 0x1C0) + 0xEA6C);
if(dwStruct=!0)
{
CPlayer *pPlayer = (CPlayer*)dwStruct;
if((pPlayer) && (strlen(pPlayer->Name) > 2) && (pPlayer->iHealth > 0)) //check if player is alive and valid
{
D3DXVECTOR3 Position;
if(WorldToScreen(pDevice, pPlayer, &Position))
{
sprintf(szFormat,"%s",pPlayer->Name);
sprintf(szFormat,"%s",pPlayer->iHealth);
}
}
}
}
}
}
void DrawBox(int x, int y, int w, int h, D3DCOLOR col, LPDIRECT3DDEVICE9 pDevice)
{
struct PanelVertex {
float x,y,z,rhw;
DWORD dwColor;
};
IDirect3DVertexBuffer9 *pVertexBuffer = NULL;
PanelVertex pV[4];
BYTE *pVertexData = NULL;
if (pDevice->CreateVertexBuffer((4*sizeof(PanelVertex)),(D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC),(D3DFVF_XYZRHW|D3DFVF_DIFFUSE),D3DPOOL_DEFAULT,&pVertexBuffer)<0) return;
pDevice->SetRenderState(D3DRS_ZENABLE , FALSE);
pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
pVertexBuffer->Lock(0,0,&pVertexData,D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD);
if(pVertexData)
{
pV[0].dwColor = pV[1].dwColor = pV[2].dwColor = pV[3].dwColor = col;
pV[0].z = pV[1].z = pV[2].z = pV[3].z = 0.0f;
pV[0].rhw = pV[1].rhw = pV[2].rhw = pV[3].rhw = 0.0f;
pV[0].x = (float)x;
pV[0].y = (float)( y + h);
pV[1].x = (float) x;
pV[1].y = (float)y;
pV[2].x = (float)(x + w);
pV[2].y = (float)(y + h);
pV[3].x = (float)(x + w);
pV[3].y = (float)y;
memcpy(pVertexData,pV,sizeof(PanelVertex)*4);
pVertexBuffer->Unlock();
pVertexData = NULL;
pDevice->SetStreamSource(0,pVertexBuffer, sizeof(PanelVertex));
pDevice->SetVertexShader( D3DFVF_XYZRHW | D3DFVF_DIFFUSE );
pDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
}
if (pVertexBuffer) {
pVertexBuffer->Release();
pVertexBuffer=NULL;
}
pDevice->SetRenderState(D3DRS_LIGHTING, true);
}
void DrawRectangle(LPDIRECT3DDEVICE9 pDevice,int x, int y, int w, int h, int s, DWORD Color)
{
DrawBox(x, y, w, s, Color, pDevice );
DrawBox(x, y, s, h, Color,pDevice );
DrawBox( (x+w), y, s, h, Color,pDevice );
DrawBox( x, (y+h), w+s, s, Color, pDevice );
}
void Boarders(LPDIRECT3DDEVICE9 pDevice)
{
DrawBox(1,20,Mxofs+45,Mmax*Mysize+15,BackGround,pDevice);
DrawBox(1,1,Mxofs+45,15,BackGround,pDevice);
DrawRectangle(pDevice,1,1,Mxofs+45,15,1,BoarderColor);
DrawRectangle(pDevice,1,20,Mxofs+45,Mmax*Mysize+15,1,BoarderColor);}
BOOL WINAPI DllMain(HINSTANCE module, DWORD dwReason, LPVOID lpvReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)ESP, NULL, NULL, NULL); //create the new Thread
}
return TRUE;
}