I'm currently working on a bot that is in a loop for clicking. Everything's working perfectly although there's one problem... I can't stop it constantly clicking without closing the program.
#include <iostream>
#include <windows.h>
usingnamespace std;
int main()
{
cout<<"Instructions:\n";
cout<<" -Move your mouse over where you want it.\n";
cout<<" -Hit '1'.\n";
cout<<" -And then hit that enter button.\n";
cout<<"Be careful. It constantly clicks.";
int mousePos;
cin>>mousePos;
unsignedint count; //For huge number
for (int i = 0; i < count; ++i)
{
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Sleep(500); //Wait 500 miliseconds
}
cin.get();
return 0;
}
Is it possible nest an If statement in there that's timed? Maybe something like this:
#include <iostream>
#include <windows.h>
usingnamespace std;
int main()
{
cout<<"Instructions:\n";
cout<<" -Move your mouse over where you want it.\n";
cout<<" -Hit '1'.\n";
cout<<" -And then hit that enter button.\n";
cout<<"Be careful. It constantly clicks.";
int mousePos;
cin>>mousePos;
unsignedint count; //For huge number
for (int i = 0; i < count; ++i)
{
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
if(you press something within 500 milisecs)
{
close the program;
}
else
{
continue the loop;
}
}
cin.get();
return 0;
}