Hotkeys

Posts 115 of 21 · Page 1 of 2
Hotkeys
I've been getting really frustrated with added hotkeys
Heres 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 PushToConsole(const char* Command) {
DWORD CNADDIE = 0x007d9200;
void* Send = ( void* )*( DWORD* )(CNADDIE);
__asm
{
push Command;
call Send; 
add esp, -3-1+2+6;
}
}	
void main()
{
	bool hack = false;
while(true)
{
if(GetAsyncKeyState(VK_NUMPAD0) < 0){
    hack = !hack;
    if(hack){
        PushToConsole("SkelModelStencil 1");
    } else {
        PushToConsole("SkelModelStencil 0");
    }
    Sleep(200);
}
}
}



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;
}
What am I doing wrong?
Thanks + Rep.
wow u dont know how to code do you
I don't understand.. what problem do you have?
It builds and all that, but the hotkey won't work ingame.
Add a sleep statement into your while loop to reduce lag. Also, you don't even need the dwHackThread it's useless..
Add the IsGameReadyForHook into the main function before your while loop and change the createthread as well from dwHackThread.
add
hack=true; first after ur first pushtoconsole
then add
hack=false; after ur second one

then it would look like this:
Code:
if(GetAsyncKeyState(VK_NUMPAD0) < 0){
    hack = !hack;
    if(hack){
        PushToConsole("SkelModelStencil 1");
        hack=true;
    } else {
        PushToConsole("SkelModelStencil 0");
        hack=false;
{
if( GetModuleHandleA( "d3d9.dll" ) != NULL
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL
&& GetModuleHandleA( "CShell.dll" ) != NULL )
return true;
return false;
}


wouldnt that return true, then return false? or does return work like "return to previous position and give this as a result" and only use the first return it sees?
The problem come from the function PushToConsole
You have an error in this function

Near the esp
press return after the } after sleep(200)
looks like this
Code:
Sleep(200)
}                        <-------press return after this
                           <----------You get this 
}
}
I think i know what is the problem:

if(GetAsyncKeyState(VK_NUMPAD0) < 0){
hack = !hack;
if(hack){
PushToConsole("SkelModelStencil 0");
} else {
PushToConsole("SkelModelStencil 1");
}

Try This
Quote Originally Posted by o-o View Post
I think i know what is the problem:

if(GetAsyncKeyState(VK_NUMPAD0) < 0){
hack = !hack;
if(hack){
PushToConsole("SkelModelStencil 0");
} else {
PushToConsole("SkelModelStencil 1");
}

Try This
That's not the problem it's the exact same thing except it will start out differently by turning of NX cham when they aren't on.
Okay, i'm getting 50 different pieces of advice.
What do you suggest I do..
Lmao, nvm.
Seal, helped with with the code, and I made the newbiest mistake in the world.
NumLock was off :P
Quote Originally Posted by tempta43 View Post
Lmao, nvm.
Seal, helped with with the code, and I made the newbiest mistake in the world.
NumLock was off :P
i had that problem too, which is why im looking into check the state of 2 keys at once. i just cant find any good documentation on GetAsyncKeyState
Posts 115 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?