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.