Postd3d hack error

Posts 1–3 of 3 · Page 1 of 1
d3d hack error
when i join game the player screen flickers and i dont know what the problem is
base.cpp
Code:
#include <d3d9.h>
#include <d3dx9.h>
#include "Quelle.h"
#include "color.h"
#include "detour.h"
#include "int.h"
#include "Hacks.h"
#include "d3dmenu.h"
#include <iostream>
#include <iomanip>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "D3DX9.LIB")


D3D9Menu *Bl4ck = NULL;
CD3DFont*  pFont;

bool Color = true;
bool Create;

char *folder[]	= {"[+]", "[-]"};
char *onoff[]	= {"[OFF]", "[ON]"};
void RebuildMenu(void)
   {
 Bl4ck->AddFolder("Hacks",folder, &folder1,2);
   ;if (folder1)
   {
   Bl4ck->AddItem	 (" NFD",onoff, &CH_NFD,1);
   Bl4ck->AddItem	 (" SuperJump",onoff, &CH_Superjump,1);
}
}

typedef HRESULT ( WINAPI* oPresent ) ( LPDIRECT3DDEVICE9 pDevice, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);
oPresent pPresent;

HRESULT WINAPI myPresent ( LPDIRECT3DDEVICE9 pDevice, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{
	pFont = new CD3DFont("Trebuchet MS", 8, D3DFONT_BOLD);
	pFont->InitDeviceObjects(pDevice);
	pFont->RestoreDeviceObjects();

	if(Bl4ck == NULL)
		{
			Bl4ck = new D3D9Menu("Addmeasfd1/Khaine914 D3D");
		}else{
			Bl4ck->MenuShow(12,10,pFont,pDevice);
			if(Bl4ck->Mmax==0) RebuildMenu();
			Bl4ck->MenuNav();
		
		}

	Hacks();
	
	delete pFont;

return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}

DWORD dwDrawindexedprimitive_ret;

HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, UINT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
{	  
  LPDIRECT3DVERTEXBUFFER9 Stream_Data;
  UINT Offset = 0;
  UINT m_Stride = 0;


  if(pDevice->GetStreamSource(0, &Stream_Data, &Offset, &m_Stride) == D3D_OK)
  Stream_Data->Release();

//D3D Funcs
 __asm
   {
    popad
       jmp dwDrawindexedprimitive_ret;

   }
}

int D3D(void)
{
	HINSTANCE	hD3D;
	DWORD		vTable[105];
	hD3D=0;
	do {
		hD3D = GetModuleHandle("d3d9.dll");
		if (!hD3D) Sleep(10);
	} while(!hD3D);

	if (D3Ddiscover((void *)&vTable[0],420)==0) return 0;
	{

		pPresent = (oPresent)DetourCreate((DWORD)vTable[17], (DWORD)myPresent,12);

			
		Sleep(100);
	}

	return 0;
}	


BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH) 
	{	HideModule(hDll);
		EraseHeaders(hDll);               
	    CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)D3D, NULL, NULL, NULL);
	}
	return TRUE;
}


Hacks.h
Code:
#include "Addies.h"

void Hacks()
{
	DWORD Player = *(DWORD*) ADR_PlayerPointer;
	DWORD Server = *(DWORD*) ADR_ServerPointer;

	if (Player != 0)
	{
		//Player Hacks
		if(CH_NFD==1)
{
*(float*)(ADR_PlayerPointer+ADR_OFFSET_NOFALLDAMAGE) = -20000;
} 
		if(CH_Superjump==1)
{
*(float*)(ADR_PlayerPointer+OFS_Z) = -20000;
} 
		//Hacks ends
	}

	if (Server != 0)
	{
		//ServerHacks
		//ServerHacks ends
	}

}
Let me have a look
I already see some things in your code.
starting at Base.cpp
either you explain to me why you have :
#include <iostream>
#include <iomanip>

or you just delete them right away

Second:
you have this code:

Code:
void RebuildMenu(void)
   {
 Bl4ck->AddFolder("Hacks",folder, &folder1,2);
   ;if (folder1)
   {
   Bl4ck->AddItem	 (" NFD",onoff, &CH_NFD,1);
   Bl4ck->AddItem	 (" SuperJump",onoff, &CH_Superjump,1);
}
}
it should be like this:
Code:
void RebuildMenu(void)
   {
 Bl4ck->AddFolder("Hacks",folder, &folder1,2);
   if (folder1)
   {
   Bl4ck->AddItem	 (" NFD",onoff, &CH_NFD,2);
   Bl4ck->AddItem	 (" SuperJump",onoff, &CH_Superjump,2);
}
See the difference?
let me explain it to you
void RebuildMenu(void)
{
Bl4ck->AddFolder("Hacks",folder, &folder1,2);
; // why do you have this ??? its used to end a line not to open one if (folder1)
{
Bl4ck->AddItem (" NFD",onoff, &CH_NFD,1 //1 ? the function asks you here how many choice's you got in this case its 2 OFF and ON);
Bl4ck->AddItem (" SuperJump",onoff, &CH_Superjump,1// same story here);
}

and in Hacks.h
you have some misstakes as well.

Code:
		if(CH_NFD==1)
{
*(float*)(ADR_PlayerPointer+ADR_OFFSET_NOFALLDAMAGE) = -20000; // you are using ADR_PlayerPointer here trust me if you do it like this it wont even work. you want to use the DWORD Player
}
// do it like this
		if(CH_NFD==1)
{
*(float*)(Player+ADR_OFFSET_NOFALLDAMAGE) =  -20000;
}
on the superjump code you get the wrong idea.
Code:
		if(CH_Superjump==1)
{
*(float*)(ADR_PlayerPointer+OFS_Z) = -20000;
}
wat you want to do right know is to put the player to minus 20000 when the hack is turned on and the he is not going to fall back to the real world of the game anymore

it would be better if you would ask for a key to be pressed to bring him there.

like this:

Code:
if(CH_Superjump==1)
{
   if(GetAsyncKeyState(VK_CONTROL)&1) // Press the left Control key to superjump
{
     *(float*)(Player+OFS_Z) = 5000;// instead of -20000 you want to put 5000 or something like that in here its a superjump remember not a downjump
}}
So I hope this helped you.
It could be that i missed something here. but hea I already did much of your work didn't I?
If your still having problems send me a pm so I can help you trough TeamViewer or something like that.

also don't try to rush this learn.



Regards,
geakzornl
ok when i complete i will also give you credits
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