Trying to make Rapid Fire

So I've made a c++ tool for cod but I want to make it so I press a button and it starts. I just made it so when you type something then press enter it starts to shoot. I know how to hide the window but I don't know how to set a button to start sorry but I don't know it all.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <cstdlib>
#include <iostream>
#include <windows.h>

using namespace std;

int main()
{
    int x,y,i;
    cout << "When do I click now?" << endl;
    cin >> i;
    if (i < 10)
    {
          SetCursorPos(700,700);
          mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
          mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
          Sleep(100);
          mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
          mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
          Sleep(100);
          mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
          mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
          Sleep(100);
          mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
          mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
          Sleep(100);
          mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
          mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
          Sleep(100);
........
.......
......
.....
....
...
..
.
    }
    else
    {
        Sleep(100);
    }
    system("PAUSE");
    return 0;
}

Last edited on
Do you know how to make for loops? There's no need to copy past that code thousands of times like that.
what kind of loop should I use?
I only mentioned for loops, that should only mean one kind of loop to you.
http://www.cplusplus.com/doc/tutorial/control/#for
Last edited on
Okay how can I make it so it presses and release the click without coordinates?
To be honest, I didn't even know you could do it with coordinates. I guess if you wanted you could just get the current mouse position first?
Last edited on
Topic archived. No new replies allowed.