Tutorial On Chams
By Thimo
Requirments:
-D3D Starter Kit V3.0B
-Generatetexture Function
-Microsoft Visual C++/ Studio
-Brain
-Knowledge of C++
-MSDN
-D3D SDK
Seting up:
Download The starter kit to you desktop and open it.
Coding:
First we are going to make a Wallhack:
In the starter kit go to d3d8dev.ccp
Under the #defines
Code:
bool wallhack; //made by thimo
UINT m_Stride; //made by thimo
Place this in DrawIndexedPrimitive
Code:
if (wallhack) //If wallhack bool is called.
{
if(m_stride == 44) //On the players model.
{
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); //Then bring to the front
}
else
{
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, TRUE); //Evertyhing else is normal
}
}
if ((GetAsyncKeyState(VK_NUMPAD1)&1) == 1) // If get numpad 1 then
wallhack = !wallhack; //toggle wallhack
Chams:
Start with the same code as above
On top:
Code:
bool chams;
UINT m_Stride;
LPDIRECT3DTEXTURE8 texRed, texGreen; //textures
Now in DrawIndexedPrimitive:
Code:
if (chams) //if cham bool is called
{
if (m_Stride == 44) //on the player models
{
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE,false); //bring to front
m_pD3Ddev->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); //fill it with a solid color
m_pD3Ddev->SetTexture( 0, texRed); //fill it wih red
m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);
m_pD3Ddev->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
m_pD3Dde->SetTexture( 0, texGreen); //fill it with green
}
if ((GetAsyncKeyState(VK_NUMPAD2)&1) == 1) //id numpad 2 is called then
Chams = !Chams; //chams on and off
Now we need to make Colors!
The GenerateTextyure Function by Az0rbix
Now search for
Code:
HRESULT CD3DManager::Release()
Under
Code:
HRESULT CD3DManager::Release()
{
return S_OK;
}
Add the GenerateTexture Function
Code:
HRESULT GenerateTexture(IDirect3DDevice8 *pD3Ddev, IDirect3DTexture8 **ppD3Dtex, DWORD colour32)
{
if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex)) )
return E_FAIL;
WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
|(WORD)(((colour32>>20)&0xF)<<8)
|(WORD)(((colour32>>12)&0xF)<<4)
|(WORD)(((colour32>>4)&0xF)<<0);
D3DLOCKED_RECT d3dlr;
(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
WORD *pDst16 = (WORD*)d3dlr.pBits;
for(int xy=0; xy < 8*8; xy++)
*pDst16++ = colour16;
(*ppD3Dtex)->UnlockRect(0);
return S_OK;
}
Now in EndScene we are going to make those funtions!
Search for EndScene
in endscene add:
Code:
GenerateTexture(m_pD3Ddev, &texRed,D3DCOLOR_ARGB(255,255,0,0));
GenerateTexture(m_pD3Ddev, &texGreen,D3DCOLOR_ARGB(255,0,255,0));
and in SetStreamSource we put:
Code:
if( StreamNumber == 0 ){m_Stride = Stride;}
Made by thimo
Report any Bugs
Creditz:
Me = Tutorial
Cobra = Basics
Str8Soulja = Niggah******
Az0rbix = D3D starter kit + GenerateTexture Function