QuestionCreating Hot-Keys For My Hack [Solved]

Posts 1–8 of 8 · Page 1 of 1
Creating Hot-Keys For My Hack [Solved]
I've been trying to figure this out for about 2 days. Sorry if this is an easy one to solve, but I just can't work it out.

Okay, so here is my code:

Code:
			while(true) // Loops so the memory keeps rewriting itself if it's changed.
				{
                if (GetAsyncKeyState(VK_F1)&1) // If the "F1" hotkey is pressed then it will write the new data to the memory address.
                    {
						WriteProcessMemory(trollpr0c3zz, (LPVOID)ammo_addr, &troll, umgh4x0rz, NULL);
                }
                if (GetAsyncKeyState(VK_F2)&1) // If the "F2" hotkey is pressed then it will write the new data to the memory address.
                    {
						WriteProcessMemory(trollpr0c3zz, (LPVOID)round_addr, &troll, umgh4x0rz, NULL);
                }
			} // End of loop.
Basically, I'm trying to get my program to modify the memory when I press a hotkey; which works fine. However, I want it to make it loop so it continously modifies the memory since it changes when the value is changed. I have to hold the hotkey down for it to continously write the new memory. I want to be able to press my hotkeys once and it continously writes the memory over and over again so it's in a sort of 'freeze' state.

Thanks a lot guys .
Set a boolean value up outside your infinite "while" loop, then the hotkeys toggle this to true or false. Then just write the value during the loop if the boolean is true.

pseudocode
Code:
bool do_something = false;
infinite_loop
{
    if ( hotkey_pressed() )
        do_something = !do_something; //toggle do_something

    if ( do_something ) //if we should be doing something
        WriteProcessMemory(...)
}
Code:
				bool AmmoHax = false;
				bool RoundsHax = false;

			while(1) // Loops so the memory keeps rewriting itself if it's changed.
				{
                if (GetAsyncKeyState(VK_F1)&1) // If the "F1" hotkey is pressed then it will write the new data to the memory address.
                    {
						AmmoHax = !AmmoHax;
						
						if (AmmoHax)
						{
						WriteProcessMemory(trollpr0c3zz, (LPVOID)ammo_addr, &troll, umgh4x0rz, NULL);
						}
                }
                if (GetAsyncKeyState(VK_F2)&1) // If the "F2" hotkey is pressed then it will write the new data to the memory address.
                    {
						RoundsHax = !RoundsHax;

						if (RoundsHax)
						{
						WriteProcessMemory(trollpr0c3zz, (LPVOID)round_addr, &troll, umgh4x0rz, NULL);
						}
                }
			} // End of loop.
This still doesn't work :\.
Quote Originally Posted by Phizo View Post
Code:
				bool AmmoHax = false;
				bool RoundsHax = false;

			while(1) // Loops so the memory keeps rewriting itself if it's changed.
				{
                if (GetAsyncKeyState(VK_F1)&1) // If the "F1" hotkey is pressed then it will write the new data to the memory address.
                    {
						AmmoHax = !AmmoHax;
						
						if (AmmoHax)
						{
						WriteProcessMemory(trollpr0c3zz, (LPVOID)ammo_addr, &troll, umgh4x0rz, NULL);
						}
                }
                if (GetAsyncKeyState(VK_F2)&1) // If the "F2" hotkey is pressed then it will write the new data to the memory address.
                    {
						RoundsHax = !RoundsHax;

						if (RoundsHax)
						{
						WriteProcessMemory(trollpr0c3zz, (LPVOID)round_addr, &troll, umgh4x0rz, NULL);
						}
                }
			} // End of loop.
This still doesn't work :\.
Code:
				bool AmmoHax = false;
				bool RoundsHax = false;

			while(1) // Loops so the memory keeps rewriting itself if it's changed.
				{
                if (GetAsyncKeyState(VK_F1)&1)
						AmmoHax = !AmmoHax;			
                
                if (GetAsyncKeyState(VK_F2)&1)
			RoundsHax = !RoundsHax;

						if (RoundsHax)									

WriteProcessMemory(trollpr0c3zz, (LPVOID)round_addr, &troll, umgh4x0rz, NULL);
									if (AmmoHax)
				WriteProcessMemory(trollpr0c3zz, (LPVOID)ammo_addr, &troll, umgh4x0rz, NULL);			
                
			} // End of loop.
Quote Originally Posted by Saltine View Post

Code:
				bool AmmoHax = false;
				bool RoundsHax = false;

			while(1) // Loops so the memory keeps rewriting itself if it's changed.
				{
                if (GetAsyncKeyState(VK_F1)&1)
						AmmoHax = !AmmoHax;			
                
                if (GetAsyncKeyState(VK_F2)&1)
			RoundsHax = !RoundsHax;

						if (RoundsHax)									

WriteProcessMemory(trollpr0c3zz, (LPVOID)round_addr, &troll, umgh4x0rz, NULL);
									if (AmmoHax)
				WriteProcessMemory(trollpr0c3zz, (LPVOID)ammo_addr, &troll, umgh4x0rz, NULL);			
                
			} // End of loop.
Wow, thanks a lot man! Works perfectly .
Yea you had the scope of your if statements wrong.
Quote Originally Posted by Jason View Post
Yea you had the scope of your if statements wrong.
Oh, yeah. I see what I did wrong. Your code was also correct, Jason.

Thank a lot guys .
GJ both of you.
/Marked Solved.
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us