how to make my program pause and resume

closed account (9i3hURfi)
c++ what i am doing is making a autoprone program that when you shoot at someone in say call of duty you go prone while your shooting, im trying to make it so the user can pause it so it no longer makes them go prone when they press the shoot button. then be able to resume when they press the same button or another button such as F11
1
2
3
4
5
6
7
8
9
10
11
12
if (userkey == "start"){
	while(true){
	if (GetAsyncKeyState(VK_LBUTTON) & 0x0001)
	{
		keybd_event( VK_CONTROL,0x11,KEYEVENTF_EXTENDEDKEY | 0,0 );
        keybd_event( VK_CONTROL,0x11,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);
		cout << "Going prone ";
	}

	if (GetAsyncKeyState(VK_F11) & 0x0001){
	break;
	}


i changed it to a break but im not sure how to well break a break. how to continue
Last edited on
closed account (9i3hURfi)
any ideas people lol. i found no answers on google
You don't really want to pause and resume. You want to toggle whether or not that piece is executed.

You could do something like:

1
2
3
4
5
bool proneToggle=true;
if(/*F11 key is pressed*/)
     proneToggle = !proneToggle;
if(proneToggle)
     //do stuff 
closed account (9i3hURfi)
i tried that but im not quite sure what to do where you said do stuff. i want to be able to toggle on and off multiple times of what i posted
Topic archived. No new replies allowed.