Results 1 to 5 of 5
  1. #1
    gogogokitty's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    1,090
    Reputation
    113
    Thanks
    3,503

    on/off hotkey problem

    when i press F1 i want it to toggle a value to 1, then when that key is pressed again i want it to change the value to 0 and so on and so on as much as the user wants to switch between 1 and 0.
    God is a boolean with no starting value when it was declaired. ive been trying to figure it out myself for the past 45 minutes or so without luck(my excuse is this is my first time opening visual studio in about a yearish )

    Code:
                                     if (GetAsyncKeyState(VK_F1) & 0x0001){
    				(ReadProcessMemory(hProcess,(void*)Gadr,&God,sizeof(Points),0));
    				if (God = 0){
    					God = 1;
    				(WriteProcessMemory(hProcess, (LPVOID)Gadr, &God, sizeof(Points), NULL));
    				cout << "God Mode ON" <<endl;
    				(ReadProcessMemory(hProcess,(void*)Gadr,&God,sizeof(Points),0));
    				cout << God <<endl;
    				}
    				else{
    					if (God = 1){
    						God = 0;
    					(WriteProcessMemory(hProcess, (LPVOID)Gadr, &God, sizeof(Points), NULL));			
    				cout << "God Mode OFF" <<endl;
    					}
    				}
    }
    Last edited by gogogokitty; 02-02-2016 at 03:55 PM.
    LEEEEEEROY JEEEEENKINS

  2. #2
    InunoTaishou's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    The Internet
    Posts
    446
    Reputation
    20
    Thanks
    951
    My Mood
    Relaxed
    Code:
    	God = !God;
    	
    	if (God) {
    		// Execute stuff
    	}
    Last edited by InunoTaishou; 02-02-2016 at 04:30 PM.
    https://www.mpgh.net/forum/signaturepics/sigpic210976_1.gif

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

    gogogokitty (02-02-2016)

  4. #3
    gogogokitty's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    1,090
    Reputation
    113
    Thanks
    3,503
    Quote Originally Posted by InunoTaishou View Post
    Code:
    	God = !God;
    	
    	if (God) {
    		// Execute stuff
    	}
    thank you so much
    LEEEEEEROY JEEEEENKINS

  5. #4
    Orinion77's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Posts
    140
    Reputation
    10
    Thanks
    47
    My Mood
    Relaxed
    The problems in your code were the comparisons:
    Code:
    if (God = 1)
    is compleatly wrong

    Code:
    if (God == 1)
    Thats how you compare.

  6. #5
    AuT03x3C's Avatar
    Join Date
    Nov 2014
    Gender
    male
    Location
    kernel32.dll
    Posts
    453
    Reputation
    11
    Thanks
    4,561
    My Mood
    Sleepy
    @gogogokitty I would recommend you to relearn comparison operators.

Similar Threads

  1. [Help Request] Hotkey Problem
    By ySoNoob in forum Visual Basic Programming
    Replies: 14
    Last Post: 05-12-2013, 07:49 AM
  2. [Solved] Hotkey problem!
    By NitroSmily in forum Call of Duty Modern Warfare 3 Coding, Programming & Source Code
    Replies: 3
    Last Post: 09-28-2012, 11:23 AM
  3. [Help] VB.NET Hotkey problem
    By ninjastormns in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 4
    Last Post: 07-30-2012, 06:47 PM
  4. Call Of Duty 5 problem. Sorry a little off topic :/
    By Rixmann22 in forum Call of Duty 5 - World at War Hacks
    Replies: 5
    Last Post: 07-08-2009, 05:13 PM
  5. Hotkeys on VB6 Problem
    By ........ in forum Visual Basic Programming
    Replies: 9
    Last Post: 09-25-2007, 02:46 PM