Thread: [C++] Toggle

Results 1 to 11 of 11
  1. #1
    Dewerong's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    Inside a Packet
    Posts
    59
    Reputation
    10
    Thanks
    2

    [C++] Toggle

    bool AutoShoot=false;
    bool Toggle = false;
    if (KeyPressed == VK_F6)
    {
    if(Toggle)
    {
    AutoShoot=true;
    }

    else
    {

    AutoShoot=false;
    }
    }
    Can someone tell me how to make a toggle in C++? I've been learning with a C++ tutorial (idk if I can link to it). This is how the tutorial say do it:

    bool bValue = true;
    if (!bValue)
    cout << "The if statement was true" << endl;
    else
    cout << "The if statement was false" << endl;
    But then another tutorial said do it a different way. Help?

  2. #2
    UltimateX1's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    114
    Reputation
    10
    Thanks
    10
    My Mood
    Yeehaw

  3. #3
    Crash's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    JAville
    Posts
    2,889
    Reputation
    163
    Thanks
    3,289
    My Mood
    Sleepy
    roflwrong.
    /
    Last edited by Crash; 10-07-2010 at 03:19 PM. Reason: wrong

  4. The Following User Says Thank You to Crash For This Useful Post:

    Dewerong (10-07-2010)

  5. #4
    Dewerong's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    Inside a Packet
    Posts
    59
    Reputation
    10
    Thanks
    2
    UltimateNoobX1, your a idiot. I was converting it my hotkey function from asm to C++. I know about GetAsyncKeyState.

    HotkeyFunc proc
    @GoBack:

    invoke GetAsyncKeyState, VK_F5
    .if eax !=0
    .if maphack == 0
    mov maphack, 1
    invoke WriteMem, 1827678h, addr liteon, 1
    invoke WriteMem, 0A31CBFh, addr NOP6, 6
    print "Maphack / Cam lock is on",
    .else
    mov maphack, 0
    invoke WriteMem, 1827678h, addr liteoff, 1
    invoke WriteMem, 0A31CBFh, addr camrestore, 6
    print "Maphack / Cam lock is off",
    .endif

    Events:
    invoke Sleep, 100
    jmp @GoBack

    HotkeyFunc endp
    So please don't act smart cause I can make you look really dumb. Thanks, Crash.

    @Crash:
    I now have this

    if (keyCode == VK_F6)
    {
    if(Toggle)
    {
    Toggle = !Toggle;
    AutoShoot=true;
    }

    else
    {

    Toggle = !Toggle;
    AutoShoot=false;
    }
    }
    Would that work?
    Last edited by Dewerong; 10-07-2010 at 03:15 PM.

  6. #5
    Crash's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    JAville
    Posts
    2,889
    Reputation
    163
    Thanks
    3,289
    My Mood
    Sleepy
    roflwrong.
    Last edited by Crash; 10-07-2010 at 03:19 PM. Reason: wrong.

  7. #6
    Dewerong's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    Inside a Packet
    Posts
    59
    Reputation
    10
    Thanks
    2
    I wasn't talking to you. I meant the guy that posted above you. I fixed my post though. It was because he posted before you and then I was posting. Then you posted. So it looked like my post was directed to you.

    @Crash:
    I now have this

    if (keyCode == VK_F6)
    {
    if(Toggle)
    {
    Toggle = !Toggle;
    AutoShoot=true;
    }

    else
    {

    Toggle = !Toggle;
    AutoShoot=false;
    }
    }
    Would that work?

  8. #7
    Crash's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    JAville
    Posts
    2,889
    Reputation
    163
    Thanks
    3,289
    My Mood
    Sleepy
    Quote Originally Posted by Dewerong View Post
    I wasn't talking to you. I meant the guy that posted above you. I fixed my post though. It was because he posted before you and then I was posting. Then you posted. So it looked like my post was directed to you.

    @Crash:
    I now have this



    Would that work?
    Oh rofl it really looked like you were talking to me.

    And it would be more like this :

    Code:
    if(GetAsyncKeyState(VK_F6)&1){
    
        toggle = !toggle;
        if(toggle){
            //Do whatever
        } else {
            //Do if it's not on
        }
    }
    Sorry about that mix-up.

  9. The Following User Says Thank You to Crash For This Useful Post:

    Dewerong (10-07-2010)

  10. #8
    Dewerong's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    Inside a Packet
    Posts
    59
    Reputation
    10
    Thanks
    2
    The "Quick Reply" button isn't working. Anyways, thanks.

  11. #9
    HL-SDK's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    56
    Reputation
    11
    Thanks
    26
    That is equivalent code and would be optimized.
    [php]if (keyCode == VK_F6)
    {
    Autoshoot ^= 1;
    if (Autoshoot)
    ;
    else
    ;
    } [/php]

  12. #10
    UltimateX1's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    114
    Reputation
    10
    Thanks
    10
    My Mood
    Yeehaw
    well i still think you should use google

  13. #11
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,690
    Reputation
    184
    Thanks
    1,147
    My Mood
    Aggressive
    Quote Originally Posted by HL-SDK View Post
    That is equivalent code and would be optimized.
    [php]if (keyCode == VK_F6)
    {
    Autoshoot ^= 1;
    if (Autoshoot)
    ;
    else
    ;
    } [/php]

    That = better.

Similar Threads

  1. [Release]Advanced Aimbot - Toggle on/off - Select all possible aimbones -
    By kaf073 in forum Call of Duty Modern Warfare 2 Private Servers
    Replies: 37
    Last Post: 06-23-2010, 12:18 AM
  2. [Help]Toggle Key[Solved]
    By Alroundeath in forum Visual Basic Programming
    Replies: 5
    Last Post: 04-23-2010, 09:18 AM
  3. Cannot toggle on hack
    By Ph0enix4Lyfe in forum Alliance of Valiant Arms (AVA) Hacks & Cheats
    Replies: 9
    Last Post: 10-20-2009, 09:57 PM
  4. toggling
    By mtwell in forum Combat Arms Hacks & Cheats
    Replies: 2
    Last Post: 04-27-2009, 06:26 PM
  5. Very Useful {toggle Speedhack} tut
    By SEGnosis in forum Combat Arms Hacks & Cheats
    Replies: 12
    Last Post: 10-22-2008, 11:00 PM