sp chams,,,

Posts 1–3 of 3 · Page 1 of 1
sp chams,,,
been following a tutorial, game runs but is black and my menu wont display the text,,, its all in my chams attempt.. can somone help plz

Code:
#include "base.h"
#include <windows.h>
#include <time.h>

#define NOP 0x90
UINT Stride;
#define drawchams ((NumVertices == 803|| NumVertices==829 || NumVertices == 789 || NumVertices ==784 || NumVertices ==556 || NumVertices ==152 || NumVertices ==468 || NumVertices ==334 || NumVertices ==327 || NumVertices ==229 || NumVertices ==232 || NumVertices ==222 || NumVertices ==171 || NumVertices ==157 || NumVertices ==922))
oDIP pDIP;
oReset pReset;
//oSetStreamSource  pSetStreamSource;
oEndScene pEndScene;
DWORD proc_id;
DemonMenu dMenu;
LPDIRECT3DDEVICE9 g_pDevice = 0; 
LPDIRECT3DTEXTURE9    texYellow, texRed;
D3DVIEWPORT9 g_ViewPort;
bool chams = true;
bool Generate = true;


float MenuBar=0.0f;
float CenterX=0.0f;
float CenterY=0.0f;
float MenuX=0.0f;

int xFontOffSet = 15;
int yFontOffSet = 25;
int hackopt1;
int MenuHeight = 10;
int show=1;
int b = 0;

int hack0 = 0;
int hack1 = 0;
int hack2 = 0;
int hack3 = 0;
int hack4 = 0;
int hack5 = 0;
int hack6 = 0;
int hack7 = 0;
int hack8 = 0;

int god = 0;
int ammo = 0;
int xhair = 0;
int money = 0;
int superjump = 0;
int thundergun = 0;
int minigun = 0;
int fps = 0;

void DemonMenu::CreateItem(int index, char * title, int *hack, int hackmaxval,int hacktype)
{

	hackcount++;
	HACKITEM[hackcount].index = index;
	HACKITEM[hackcount].hack = hack;
	HACKITEM[hackcount].hackmaxval = hackmaxval;
	HACKITEM[hackcount].hacktype = hacktype;
	PrintText(title, xFontOffSet, (index*15)+12,HACKITEM[hackcount].HCOLOR,pFont); 
}

void DemonMenu::BuildMenu(char * menuname, int x, int y, int h, int w, DWORD TITLECOL, DWORD BACKCOLOR, DWORD BORDERCOLOR, LPDIRECT3DDEVICE9 pDevice)
{
	
		pDevice->GetViewport(&g_ViewPort);
		MenuX = (float)g_ViewPort.Width;
		MenuBar = (float)g_ViewPort.Width;

		if(GetAsyncKeyState(VK_INSERT)&1)show=(!show);

	if(!show)
	{

		return;
	}
	DrawBox(x,y, MenuX, 22, DarkInsideFill, BORDERCOLOR, pDevice); // Top Box
	DrawBox(MenuX-200,20, 200, 500, BACKCOLOR, BORDERCOLOR, pDevice); //Right Box
	DrawBox(x,20, 200, 500, BACKCOLOR, BORDERCOLOR, pDevice); // Left Box
	PrintText(menuname, 32, y+4, TITLECOL, pFont);
	CreateItem(1,"Godmode", &hack1);
	CreateItem(2,"Ammo", &hack2); 
	CreateItem(3,"Crosshair", &hack3);
	CreateItem(4,"Super Jump", &hack4);
	CreateItem(5,"No Recoil", &hack5);
	CreateItem(6,"Chams", &hack6);
	CreateItem(7,"ThunderGun", &hack7);
	CreateItem(8,"FPS", &hack8);
	PrintText("Created by Chip Foley", 748, 850, GREEN, dMenu.pFont);
	
	RenderMenu();
}

void DemonMenu::RenderMenu()
{
	 
	if(GetAsyncKeyState(VK_DOWN)&1) 
			selector++;

	if(GetAsyncKeyState(VK_UP)&1)
		if(selector > 1)
			selector--;

	if (GetAsyncKeyState(VK_RIGHT)<0){
		for(int i=0;i < (hackcount+1);i++){
           if(selector == HACKITEM[i].index){
			   if(*HACKITEM[i].hack < HACKITEM[i].hackmaxval)
					*HACKITEM[i].hack += 1;
		}
	}
	}

	if (GetAsyncKeyState(VK_LEFT)<0){
		for(int i=0;i < (hackcount+1);i++){
           if(selector == HACKITEM[i].index){
			   *HACKITEM[i].hack = 0;
			   Sleep(200);
		}
	}
	}
	
	for(int i=0;i < (hackcount+1);i++){
		if(selector == HACKITEM[i].index)
			HACKITEM[i].HCOLOR = GREEN;
		else
			HACKITEM[i].HCOLOR = RED;
	}

	for(int i=1; i<(hackcount+1); i++){
		if(HACKITEM[i].hacktype == 0){
		if(*HACKITEM[i].hack == 1)   
		PrintText("On", xFontOffSet+150, HACKITEM[i].index*15+12,GREEN,pFont);
	 else 
		PrintText("Off", xFontOffSet+150, HACKITEM[i].index*15+12,RED,pFont);
	
	}
	}


	if(selector < 1)
		selector = 1;

	if(selector > hackcount)
		selector = 1;

	hackcount = 0;
}



int Godmode() 
{
	HWND hWnd = FindWindow(0, "Modern Warfare 2");
	while (1)
  	if(hWnd == 0)
	{
    		MessageBox(0, "Error cannot find window.", "Error", MB_OK|MB_ICONERROR);
  	} 
	else 
	{
    		DWORD proccess_ID;
    		GetWindowThreadProcessId(hWnd, &proccess_ID);
    		HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proccess_ID);
    		if(!hProcess)
		{
      			MessageBox(0, "Could not open the process!", "Error!", MB_OK|MB_ICONERROR);
    		} 
		else 
		{
      			int newdata = 50000;
     		 	DWORD newdatasize = sizeof(newdata);
      			if(WriteProcessMemory(hProcess, (LPVOID)0x0eAAD84, &newdata, 2, NULL))
			
			{
				//
      			} 
			else 
			{
        				MessageBox(NULL, "Could not WriteProcessMemory!", "Error", MB_OK + MB_ICONERROR);
      			}
      			CloseHandle(hProcess); 
				Sleep(1);
		}
  	}
  	return 0;
}

void nop_(PVOID address, int bytes)
{
	DWORD d,ds;
	VirtualProtect(address,bytes,PAGE_EXECUTE_READWRITE,&d);
	memset(address,NOP,bytes);
	VirtualProtect(address,bytes,d,&ds);
}

void HackThread()
{
	while(1)

		{
	//GodMode
		if	( hack1 == 1)
		{
			Godmode();
			//nop_((PVOID) 0x1A4C15C,2);
			god = 1;
		}
		else if (( hack1 == 0)&(god == 1))
		{
		 god = 0;
		}
	//UnlimitedAmmo
		if	(( hack2 == 1)&(ammo == 0))
		{
			nop_((PVOID) 0x004C21ED,4);
			ammo = 1;
		}
		else if (( hack2 == 0)&(ammo == 1))
		{
		 ammo = 0;
		}
	//Crosshair
		if	(( hack3 == 1)&(xhair == 0))
		{
		xhair = 1;
		}
		else if (( hack3 == 0)&(xhair == 1))
		{
		xhair = 0;
		}
	//SuperJump
			if	(( hack4 == 1)&(superjump == 0))
		{
		superjump = 1;
	//	PushToConsole("sv_cheats", 1);
	//	PushToConsole("developer", 1);
	//	PushToConsole("thereisacow", 1337);
	//	PushToConsole("jump_height", 500);
		}
		else if (( hack4 == 0)&(superjump == 1))
		{
		superjump = 0;
		//PushToConsole(1,1,"jump_height 39");
		}	
	//recoil
		if	(( hack5 == 1)&(money == 0))
		{
 
	// nop_((PVOID) 0x004E60A0,4);
		money = 1;
		}
		else if (( hack5 == 0)&(money == 1))
		{
		 money = 0;
		}
	//chams
		if	(( hack6 == 1)&(minigun == 0))
		{
		Generate = true;

		minigun = 1;
		}
		else if (( hack6 == 0)&(minigun == 1))
		{
		 minigun = 0;
		Generate = false;

		}
	//FPS
			if	(( hack8 == 1)&(fps == 0))
		{
		
		fps = 1;
		}
		else if (( hack8 == 0)&(fps == 1))
		{
		fps = 0;
		}
			Sleep(100);
	}	
}

void ReFont(LPDIRECT3DDEVICE9 pDevice)
{
    if (g_pDevice != pDevice)
    {
        g_pDevice = pDevice;
        try
        {
            if (dMenu.pFont != 0)
                dMenu.pFont->Release();
        } catch (...) {}
        dMenu.pFont = 0;
        D3DXCreateFontA(pDevice, 16, 0, FW_BOLD, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &dMenu.pFont );
    }
}

HRESULT WINAPI Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
	dMenu.pFont->OnLostDevice();

	HRESULT hRet = pReset(pDevice, pPresentationParameters);

	dMenu.pFont->OnResetDevice();

	return hRet;
}

HRESULT WINAPI EndScene(LPDIRECT3DDEVICE9 pDevice)
{
	ReFont(pDevice);
	pDevice->GetViewport(&g_ViewPort);
	MenuBar = (float)g_ViewPort.Width;
	CenterX = (float)g_ViewPort.Width / 2 - 2;
	CenterY = (float)g_ViewPort.Height / 2 - 2;

	dMenu.BuildMenu("vFaithv Cod-MW2 v1.0",0,0,180,200,LGRAY,DarkInsideFill,ORANGE,pDevice);

	if (Generate) 
	{
	GenerateTexture(pDevice, &texRed,D3DCOLOR_ARGB(255,255,0,0));
	GenerateTexture(pDevice, &texYellow,D3DCOLOR_ARGB(255,255,255,0));
	Generate = false;
	}


	if ((hack3==1)&(xhair = 1))
	{
			D3DRECT rec2 = {CenterX-15, CenterY, CenterX+17, CenterY+3}; //Width
			D3DRECT rec3 = {CenterX, CenterY-15, CenterX+3, CenterY+17}; // Height
			pDevice->Clear(1, &rec2, D3DCLEAR_TARGET,RED, 0, 0);
			pDevice->Clear(1, &rec3, D3DCLEAR_TARGET,RED, 0, 0);	
	}	
		
	
	return pEndScene(pDevice);
}
/*
HRESULT WINAPI SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) 
{

if( StreamNumber == 0 ){m_Stride = Stride;}
	return m_pD3Ddev->SetStreamSource(StreamNumber, pStreamData,OffsetInBytes, Stride);
}
*/
HRESULT WINAPI myDIP(LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE Type,int BaseVertexIndex,UINT MinIndex,UINT NumVertices,UINT StartIndex,UINT PrimCount)
{
	//myDIP(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimCount);
		if (drawchams)
		{
		pDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
		pDevice->SetTexture( 0, texYellow );
		(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimCount);
		pDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
		}
		return 0;
}
int D3Dinit(void)
{
	DWORD		hD3D, adr, *vtbl;
	hD3D=0;
	do {
		hD3D = (DWORD)GetModuleHandle("d3d9.dll");
		Sleep(10);
	} while(!hD3D);
	adr = FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
	if (adr)
	{
		memcpy(&vtbl,(void *)(adr+2),4);
		pReset	  = (oReset)	DetourFunction((PBYTE)vtbl[16]   , (PBYTE)Reset   ,5);
 		pEndScene = (oEndScene)	DetourFunction((PBYTE)vtbl[42], (PBYTE)EndScene,5);
		pDIP = (oDIP) DetourFunction((PBYTE)vtbl[82], (PBYTE)myDIP,5);
		//pSetStreamSource = (oSetStreamSource) DetourFunction((PBYTE)vtbl[100], (PBYTE)SetStreamSource,5);
 	}
	return 0;
}

BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
	DisableThreadLibraryCalls(hDll);

	if ( dwReason == DLL_PROCESS_ATTACH )
	{
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)D3Dinit, NULL, NULL, NULL);
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)HackThread, NULL, NULL, NULL);
	}
	if( dwReason == DLL_PROCESS_DETACH)
	{
		dMenu.pFont->Release();
	}
	return TRUE;
}
Nvm fixed it,, still ended up with z buffer disabled, didnt render colors... im newb
sry 4 triple post i cant edit i got it fixed


HRESULT WINAPI myDIP(LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE Type,int BaseVertexIndex,UINT MinIndex,UINT NumVertices,UINT StartIndex,UINT PrimCount)
{
//myDIP(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimCount);
if (drawchams)
{
pDevice->SetRenderState(D3DRS_ZENABLE, TRUE); <<<<<-----------------------------------------------------
pDevice->SetTexture( 0, texYellow ); -
(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimCount);
pDevice->SetRenderState(D3DRS_ZENABLE, FALSE); <<<<<<-----------------------------------------------
}
return 0;
}

Switched them around it works now,,
Enabled false 1st then disable---- got to thinkin i read somwhere it was enabled by default
ended up needing alot more model rec
i also changed NumVertices to drawchams

and instead of

(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimCount);

pDevice->DrawIndexedPirimitive, Type, BaseVertexIndex, MinIndex, drawchams, StartIndex, PrimCount);
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us