Advertisement
Justiis

Easy Autoclicker // 2019 c++

Apr 28th, 2019
6,560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. //How to make an autoclicker in c++ // 2019!
  7.  
  8. int x=0, y=0, cps;
  9. bool click=false;
  10.  
  11. void Menu()
  12. {
  13.     cout << "Add CPS (click per second):" << endl;
  14.     cin >> cps;
  15. }
  16. void Clicker()
  17. {
  18.     while (1)
  19.     {
  20.         if(GetAsyncKeyState(VK_LBUTTON)) // Left button of the mouse
  21.         {
  22.             click = true;
  23.         }
  24.        
  25.         if(GetAsyncKeyState(VK_RBUTTON)) //Right button of the mouse
  26.         {
  27.             click = false;
  28.         }
  29.        
  30.         if(click == true)
  31.         {
  32.             mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0 , 0);
  33.             mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0 , 0);
  34.             Sleep(1000/cps);
  35.         }
  36.     }
  37. }
  38. int main()
  39. {
  40.     Menu();
  41.     Clicker();
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement