Results 1 to 8 of 8
  1. #1
    Phizo's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    1

    Question 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 .
    Last edited by Phizo; 09-25-2011 at 07:32 AM. Reason: Solved.

  2. #2
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    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(...)
    }

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  3. The Following User Says Thank You to Jason For This Useful Post:

    Phizo (09-25-2011)

  4. #3
    Phizo's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    1
    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 :\.

  5. #4
    Saltine's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    493
    Reputation
    104
    Thanks
    629
    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.

  6. The Following User Says Thank You to Saltine For This Useful Post:

    Phizo (09-25-2011)

  7. #5
    Phizo's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    1
    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 .

  8. #6
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Yea you had the scope of your if statements wrong.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  9. #7
    Phizo's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    1
    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 .

  10. #8
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    GJ both of you.
    /Marked Solved.

Similar Threads

  1. [Solved] Hard to move arrow key for the hack!
    By jerryvn in forum CrossFire Help
    Replies: 11
    Last Post: 10-30-2011, 02:37 AM
  2. visual basic hot keys for combat arms
    By bayley60 in forum Combat Arms Coding Help & Discussion
    Replies: 2
    Last Post: 01-07-2011, 11:42 PM
  3. [Request] MW2 + CS Key for new hack ?
    By iknowmen in forum Game Serial Keys
    Replies: 1
    Last Post: 06-28-2010, 09:20 PM
  4. [Reqest]C++ coder/teacher needed for CA hacking![SOLVED]
    By IownzDAworldz in forum C++/C Programming
    Replies: 9
    Last Post: 06-14-2010, 05:58 PM
  5. Delete Key for CA Hack please move
    By jlane0 in forum General
    Replies: 6
    Last Post: 12-19-2008, 02:52 PM