I know that this is very sloppy coding, but all the lines here
Don't show up when the project is compiled. The whole idea of the program is to click when you move your mouse over a certain colour (made for use with the game counter-strike in this case)Code:int decision; cout << "Enter 1 to Shoot CTs in the face" << endl; cout << "Enter 2 to Find a Colour" << endl; cin >> decision; switch (decision){ case 1: anumber = 2040097; hover(); break; case 2:
Here's the whole program, there are lots of errors but it still runs.
Code:#include <cstdlib> #include <iostream> #include <windows.h> #include <winuser.h> #include <math.h> void hover(); using namespace std; int anumber = 0; int main(int argc, char *argv[]) { int decision; cout << "Enter 1 to Shoot CTs in the face" << endl; cout << "Enter 2 to Find a Colour" << endl; cin >> decision; switch (decision){ case 1: anumber = 2040097; hover(); break; case 2: cout << "What colour do you want to find?" << endl; // CT head: 2040097 cin >> anumber; hover(); } } void hover() { cout << "In hover"; HDC screen = GetDC(HWND_DESKTOP); POINT cursorPos; GetCursorPos(&cursorPos); // Get the cursor position float x = 0; x = cursorPos.x; // Access the variables float y = 0; y = cursorPos.y; int *xint = round(x); // Convert to int int *yint = round(y); if (GetPixel(screen, xint, yint) == anumber){ // Compare the coords to the colour mouse_event(MOUSEEVENTF_LEFTDOWN,x,y,0,0); // Click mouse_event(MOUSEEVENTF_LEFTUP,x,y,0,0); cout << "clicked." << endl; hover(); // Repeat } else hover(); // Repeat system("PAUSE"); }




Reply With Quote