[C++] Toggle

Posts 1–11 of 11 · Page 1 of 1
[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?
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?
roflwrong.
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?
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.
The "Quick Reply" button isn't working. Anyways, thanks.
That is equivalent code and would be optimized.
[php]if (keyCode == VK_F6)
{
Autoshoot ^= 1;
if (Autoshoot)
;
else
;
} [/php]
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.
roflwrong.
/
well i still think you should use google
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us