Why dont work??
All codes the you see in se color RED is a error what is wrong?
Why dont work??
Code:
#include "d3d9.h" #include "d3dx9.h" #include <stdio.h> #include <windows.h> #pragma comment(lib, "d3d9.lib") #pragma comment(lib, "D3DX9.LIB")
Code:
struct _Object
{
byte pad0[0x4];
float x;
float y;
float z;
};
struct CPlayer
{
__int32 Get;
_Object*Object;
byte ClientID;
__int8 Team;
char Name[12];
__int16 check;
__int8 Alive;
__int8 check2;
__int32 PlayerSlotTeam;
__int32 Tester;
bool Has_C4;
__int32 State;
__int32 Rank;
__int32 Tester2;
__int32 CheckAgain1;
__int8 iHealth;
__int8 iHealth2;
};
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);
}
}
}
}
}
}
LPD3DXMESH pSphereMesh = NULL;
LPD3DXMESH pBoxMesh = NULL;
D3DXMATRIX ObjWorldMatrices;
D3DXMATRIX SavedMatrices;
LPDIRECT3DTEXTURE9 tRed = NULL;
LPDIRECT3DTEXTURE9 tBlue = NULL;
const BYTE bRed[] = {0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00};
const BYTE bBlue[] = {0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00};
D3DXCreateSphere( pDevice, 155.0f, 8, 7, &pSphereMesh, 0);
D3DXCreateBox( pDevice,100,322,100, &pBoxMesh, 0);
D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bRed , sizeof(bRed) , &tRed );
D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bBlue , sizeof(bBlue) , &tBlue );
D3DXVECTOR3 GetMidPoint(D3DXVECTOR3 V1,D3DXVECTOR3 V2)
{
D3DXVECTOR3 Mid;
Mid.x = (V1.x+V2.x)/2;
Mid.y = (V1.y+V2.y)/2;
Mid.z = (V1.z+V2.z)/2;
return Mid;
}
void DrawSphere(D3DXVECTOR3 Pos)
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );
pDevice->GetTransform(D3DTS_WORLD, &SavedMatrices );
D3DXMatrixTranslation(&ObjWorldMatrices, Pos.x, Pos.y, Pos.z);
pDevice->SetTransform(D3DTS_WORLD, &ObjWorldMatrices);
pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME);
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
pSphereMesh->DrawSubset(0);
pDevice->SetTransform(D3DTS_WORLD, &SavedMatrices );
}
void Draw3DBox(D3DXVECTOR3 Pos)
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );
pDevice->GetTransform(D3DTS_WORLD, &SavedMatrices );
D3DXMatrixTranslation(&ObjWorldMatrices, Pos.x, Pos.y, Pos.z);
pDevice->SetTransform(D3DTS_WORLD, &ObjWorldMatrices);
pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME);
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
pBoxMesh->DrawSubset(0);
pDevice->SetTransform(D3DTS_WORLD, &SavedMatrices );
}
