UnhappyKeep getting errors with my hack...

Posts 112 of 12 · Page 1 of 1
Keep getting errors with my hack...
Okay, so... I'm new to hacking (please don't flame me, i'm trying and learning )

So, This is my code:
Code:
#include <windows.h>
bool IsGameReadyForHook()
{
if( GetModuleHandleA( "d3d9.dll"     ) != NULL 
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL 
&& GetModuleHandleA( "CShell.dll"   ) != NULL )
return true;
return false;
}
void CPush(constchar* cmd)
{
_asm
{
PUSH cmd
MOV EAX, 0x00485FA0
CALL EAX
ADD ESP, 0x4
}
}
void main()
{
while(true)
{
PushToConsole("SkelModelStencil 1");
}
}
DWORD WINAPI dwHackThread(LPVOID)
{
while( !IsGameReadyForHook() )
Sleep(100);
main();
return 0;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(NULL, NULL, dwHackThread, NULL, NULL, NULL);
}
return TRUE;
}
It is pretty much auto-on chams (I set out for it to be that, at least...)
But when I go to build, I get:

Code:
error C2065: 'constchar' : undeclared identifier
error C2065: 'cmd' : undeclared identifier
error C2448: 'CPush' : function-style initializer appears to be a function definition
error C3861: 'PushToConsole': identifier not found
Can anyone please help me? I'm completely lost. I think I have the right unwrapp console code.... And I think I have it in there right, I'm just not sure what I did wrong...
wrong place mate
Code:
//You may want to use a class for the RunConsoleCommand, IsInGame, Main, and IsGameReadyForHook Functions.
/* Just in case you decide adding some stuff.
#include <d3d9.h>
#include <d3dx9.h>
#include <d3dx9core.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h> 
#include <string>
#include <time.h>
#include <Winuser.h>
*/
#include <windows.h>
void __cdecl RunConsoleCommand( const char* cCommand )
{
	void* address = ( void* )0x00485FA0; //Unwrapped Console Address
	__asm
	{
		Push cCommand
		call address
		add esp, 0x4
	}
}
bool IsInGame()
{
	switch(*(int*)0x377B11B0) //Game Status Address
	{ 
	case 1:
		return true; //Your in a game
	case 5:
		return false; //Your in the lobby
	}
	return false; //Even if you aren't
}
void main( void )
{
	while ( true )
	{
		if ( IsInGame == true /*In-Game*/ && GetAsyncKeyState( VK_NUMPAD1 ) < 0 /*Self Explanitory*/ )
		{
			this->RunConsoleCommand( "SkelModelStencil 1" ); //On
		}else{
			this->RunConsoleCommand( "SkelModelStencil 0" ); //Off
		}
	}
}
bool IsGameReadyForHook()
{
	if( GetModuleHandleA( "d3d9.dll"     ) != NULL &&
		GetModuleHandleA( "ClientFX.fxd" ) != NULL &&
		GetModuleHandleA( "CShell.dll"   ) != NULL )
		return true;

	return false;
}
DWORD WINAPI dwHackThread( LPVOID )
{
	while ( !IsGameReadyForHook() )
		Sleep( 25 );

	main();

	return EXIT_SUCCESS;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
	DisableThreadLibraryCalls( hDll );
	if ( dwReason == DLL_PROCESS_ATTACH )
	{
		CreateThread( NULL, NULL, dwHackThread, NULL, NULL, NULL );
	}
	return TRUE;
}
Heres credits:
Me, DeadLine, Flameswort10, Gellin.

Much neater and if you get a error fix it yourself.
Those were the easiest errors to fix ever, but I'm guessing your a noobie.
I'm not going to flame or troll b/c that not me.
Additionally like DLLBaseII said, wrong section.
Make sure its MultiByte in the Project Properties.
Consider my assistance expired. Bye.
Thank you so much, and yes, I am a noobie :/ But i'm trying to learn. I searched google for those errors but nothing popped up. Thank you for not trolling, and actually helping
Quote Originally Posted by -Dimensions- View Post
Code:
//You may want to use a class for the RunConsoleCommand, IsInGame, Main, and IsGameReadyForHook Functions.
/* Just in case you decide adding some stuff.
#include <d3d9.h>
#include <d3dx9.h>
#include <d3dx9core.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h> 
#include <string>
#include <time.h>
#include <Winuser.h>
*/
#include <windows.h>
void __cdecl RunConsoleCommand( const char* cCommand )
{
	void* address = ( void* )0x00485FA0; //Unwrapped Console Address
	__asm
	{
		Push cCommand
		call address
		add esp, 0x4
	}
}
bool IsInGame()
{
	switch(*(int*)0x377B11B0) //Game Status Address
	{ 
	case 1:
		return true; //Your in a game
	case 5:
		return false; //Your in the lobby
	}
	return false; //Even if you aren't
}
void main( void )
{
	while ( true )
	{
		if ( IsInGame == true /*In-Game*/ && GetAsyncKeyState( VK_NUMPAD1 ) < 0 /*Self Explanitory*/ )
		{
			this->RunConsoleCommand( "SkelModelStencil 1" ); //On
		}else{
			this->RunConsoleCommand( "SkelModelStencil 0" ); //Off
		}
	}
}
bool IsGameReadyForHook()
{
	if( GetModuleHandleA( "d3d9.dll"     ) != NULL &&
		GetModuleHandleA( "ClientFX.fxd" ) != NULL &&
		GetModuleHandleA( "CShell.dll"   ) != NULL )
		return true;

	return false;
}
DWORD WINAPI dwHackThread( LPVOID )
{
	while ( !IsGameReadyForHook() )
		Sleep( 25 );

	main();

	return EXIT_SUCCESS;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
	DisableThreadLibraryCalls( hDll );
	if ( dwReason == DLL_PROCESS_ATTACH )
	{
		CreateThread( NULL, NULL, dwHackThread, NULL, NULL, NULL );
	}
	return TRUE;
}
Heres credits:
Me, DeadLine, Flameswort10, Gellin.

Much neater and if you get a error fix it yourself.
Those were the easiest errors to fix ever, but I'm guessing your a noobie.
I'm not going to flame or troll b/c that not me.
Additionally like DLLBaseII said, wrong section.
Make sure its MultiByte in the Project Properties.
Consider my assistance expired. Bye.
&#x202a;INTERIOR CROCODILE ALLIGATOR&#x202c;&rlm; - YouTube
thanks i been looking for an ingame function thats y my hack hasnt been working that well
Quote Originally Posted by -Dimensions- View Post
Code:
//You may want to use a class for the RunConsoleCommand, IsInGame, Main, and IsGameReadyForHook Functions.
/* Just in case you decide adding some stuff.
#include <d3d9.h>
#include <d3dx9.h>
#include <d3dx9core.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h> 
#include <string>
#include <time.h>
#include <Winuser.h>
*/
#include <windows.h>
void __cdecl RunConsoleCommand( const char* cCommand )
{
	void* address = ( void* )0x00485FA0; //Unwrapped Console Address
	__asm
	{
		Push cCommand
		call address
		add esp, 0x4
	}
}
bool IsInGame()
{
	switch(*(int*)0x377B11B0) //Game Status Address
	{ 
	case 1:
		return true; //Your in a game
	case 5:
		return false; //Your in the lobby
	}
	return false; //Even if you aren't
}
void main( void )
{
	while ( true )
	{
		if ( IsInGame == true /*In-Game*/ && GetAsyncKeyState( VK_NUMPAD1 ) < 0 /*Self Explanitory*/ )
		{
			this->RunConsoleCommand( "SkelModelStencil 1" ); //On
		}else{
			this->RunConsoleCommand( "SkelModelStencil 0" ); //Off
		}
	}
}
bool IsGameReadyForHook()
{
	if( GetModuleHandleA( "d3d9.dll"     ) != NULL &&
		GetModuleHandleA( "ClientFX.fxd" ) != NULL &&
		GetModuleHandleA( "CShell.dll"   ) != NULL )
		return true;

	return false;
}
DWORD WINAPI dwHackThread( LPVOID )
{
	while ( !IsGameReadyForHook() )
		Sleep( 25 );

	main();

	return EXIT_SUCCESS;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
	DisableThreadLibraryCalls( hDll );
	if ( dwReason == DLL_PROCESS_ATTACH )
	{
		CreateThread( NULL, NULL, dwHackThread, NULL, NULL, NULL );
	}
	return TRUE;
}
Heres credits:
Me, DeadLine, Flameswort10, Gellin.

Much neater and if you get a error fix it yourself.
Those were the easiest errors to fix ever, but I'm guessing your a noobie.
I'm not going to flame or troll b/c that not me.
Additionally like DLLBaseII said, wrong section.
Make sure its MultiByte in the Project Properties.
Consider my assistance expired. Bye.
&#x202a;INTERIOR CROCODILE ALLIGATOR&#x202c;&rlm; - YouTube
One problem I see in your code:

Code:
if ( IsInGame == true &&...)
Change that to

Code:
if ( IsInGame() &&...)
Otherwise you are checking if the address of the function IsInGame is 1, which is obviously never the case.
Quote Originally Posted by yodaliketaco View Post
One problem I see in your code:

Code:
if ( IsInGame == true &&...)
Change that to

Code:
if ( IsInGame() &&...)
Otherwise you are checking if the address of the function IsInGame is 1, which is obviously never the case.
My bad thank you.
Quote Originally Posted by yodaliketaco View Post
One problem I see in your code:

Code:
if ( IsInGame == true &&...)
Change that to

Code:
if ( IsInGame() &&...)
Otherwise you are checking if the address of the function IsInGame is 1, which is obviously never the case.
Nice one bro
Once again, press Thanks if I helped.
You errors, in friendly descriptions, are:
- 'constchar' : undeclared identifier
- 'cmd' : undeclared identifier
- 'CPush' : function-style initializer appears to be a function definition
- 'PushToConsole': identifier not found

(pretty obvious lol)
You copy - pasted some random functions into your compiler and expected it to work. Whats even sadder is that you googled the errors l0l.
Code:
void CPush(constchar* cmd)
=>
Code:
void PushToConsole(const char* cmd)
as freedompeace said, the error messages got all infos u need to fix the problem.

constchar doesnt exist in c++, its const char. the reason why the error log also says that "cmd" is an undeclared identifier is because constchar doesnt exist.
Posts 112 of 12 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?