Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Customs.h"
- using namespace std; //using namespace of standard
- string CHSETS; //making a varible to store setting choice in choice in
- string SETTR; //making a varible to store choice in
- void MainScan(ScanContents scan);
- void ScanThread(ScanContents * scan);
- void CheckColor(COLORREF pixel, int x, int y);
- bool ColorMatch(COLORREF pixel);
- int main()
- {
- string gameWindow; //making a varible to store the game window name in
- cout << "Enter A Games Window Name To Trigger Against\n"; //choosing game
- getline(cin, gameWindow); //putting window name into "gameWindow" string
- HWND appWnd = FindWindow(0, gameWindow.c_str()); //convert window name to char pointer for system to find window
- RECT rcClientPositioning; //A place to put the area for color scan rectangle X and Y cords
- while(!appWnd) //looing for window loop
- {
- system("CLS"); //clears console
- appWnd = FindWindow(0, gameWindow.c_str()); //converts to char pointer and looks for window again
- cout << "looking for : "; //tells user it is looking for window
- cout << gameWindow;
- Sleep(2000); //tells system to wait 2000 miliseconds or 2 second before looking again for window
- }
- cout << gameWindow << " Window Has Been Found!"; //tells user the window has been found
- Sleep(2000); //tells system to wait 2000 miliseconds or 2 second before proceding on to the standard settings
- while(atoi(CHSETS.c_str()) < 1 || atoi(CHSETS.c_str()) > 2) //tells system that if choice is less than 1 or greater than 2 to repeat
- {
- system("CLS"); //clears console
- cout << "Choose What You Would Like To Set A Standard To\n" << "1. Head Shots\n" << "2. Normal\n"; //ask user for a setting choice
- getline(cin, CHSETS); //Getting Number For CHSETS varible
- }
- if(CHSETS == "1")SETTR = "Enemy's Head"; //If input == 1 then setting SETTR varible to Enemy's Head
- else if(CHSETS == "2")SETTR = "Enemy's Body"; //If input == 2 then setting SETTR varible to Enemy's Bddy
- system("CLS"); //clears console
- cout << "TriggerBot Is Online For " << gameWindow << " Hover Around A " << SETTR << " To Shoot"; //tell user TriggerBot is online
- GetWindowRect(appWnd, &rcClientPositioning); //gettng windows rectanle so system can divide it for making scan area for pixel scanning
- HDC hdcMain = GetDC(HWND_DESKTOP); //Making varible to get Desktop Handle to the desktop window
- HDC hdcThread1 = GetDC(HWND_DESKTOP); //Making varible to get Desktop Handle to the desktop window
- HDC hdcThread2 = GetDC(HWND_DESKTOP); //Making varible to get Desktop Handle to the desktop window
- HDC hdcThread3 = GetDC(HWND_DESKTOP); //Making varible to get Desktop Handle to the desktop window
- int StartX = rcClientPositioning.right - rcClientPositioning.right - ((rcClientPositioning.left)/2);//the X starting point of pixel scan
- int StartY = rcClientPositioning.bottom - rcClientPositioning.bottom - ((rcClientPositioning.top)/2);//the Y ending point of pixel scan
- ScanContents scanM0(StartX, StartY, hdcMain, 30, 40, -30, -30); //creating the area to scan
- ScanContents scanM1(StartX, StartY, hdcThread1, 0, 30, -20, 10, 1); //creating the area to scan
- ScanContents scanM2(StartX, StartY, hdcThread2, 20, 5, 0, -20, 2); //creating the area to scan
- ScanContents scanM3(StartX, StartY, hdcThread3, 20, 30, 0, 10, 3); //creating the area to scan
- _beginthread((void(*)(void*))ScanThread, 0, (void*)&scanM1); //starting 2nd scan of pixels
- _beginthread((void(*)(void*))ScanThread, 0, (void*)&scanM2); //starting 3rd scan of pixels
- _beginthread((void(*)(void*))ScanThread, 0, (void*)&scanM3); //starting 4th scan of pixels
- MainScan(scan); //starting main scan of pixels
- system("PAUSE"); //pauses system
- }
- void ScanThread(ScanContents * scan)
- {
- // MessageBox(NULL, NULL, NULL, NULL);
- int debugRuntime = clock();
- while(true)
- {
- //scan up and down the screen
- for(int y = scan->StartY+scan->DeductY; y < scan->StartY+scan->CompareY; y+=3)
- {
- //scan across the screen
- for(int x = scan->StartX+scan->DeductX; x < scan->StartX+scan->CompareX; x+=3)
- {
- //Sleep(100);
- //SetCursorPos(x, y);
- CheckColor(GetPixel(scan->Hdc, x, y), x, y);
- }
- }
- //std::cout << "[THREAD "<< scan->ThreadNum << "]Took " << clock() - debugRuntime << " milliseconds to scan whole page"<< std::endl;
- //debugRuntime = clock();
- }
- _endthread();
- }
- void MainScan(ScanContents scan) //function to run the trigger bot
- {
- int DebugRunTime = clock(); //time it took clock to scan pixel area
- while(true) //infinite loop
- {
- for(int y = scan->StartY+scan->DeductY; y < scan->StartY+scan->CompareY; y+=3) //scanning Y access 3 pixels pert time
- {
- for(int x = scan->StartX+scan->DeductX; x < scan->StartX+scan->CompareX; x+=3) //scanning X access 3 pixels pert time
- {
- //SetCursorPos(x, y); //set cursor at scan position so you know its working / not needed though
- CheckColor(GetPixel(scan->Hdc, x, y), x, y); //Getting the pixel of the color and then setting cursor there to shoot
- if(GetAsyncKeyState(VK_DELETE)) //if delete key is pressed
- {
- exit(0); //exit programs
- }
- }
- }
- cout << "Thread " << scan->ThreadNum" scan took : " << DebugRunTime - clock() << " to scan pixel area"; //tell time it took to scan pixel area
- DebugRunTime = clock(); //reseting clock
- }
- }
- void CheckColor(COLORREF pixel, int x, int y) //function that presses mouse button down if CoorMatch Returns True
- {
- if(ColorMatch(pixel)) // if colormatch returns true find the pixel and run the lines instide
- {
- mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0 ,0); //presses the mouse key down at the X and Y
- mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0 ,0); //Presses mouse key back up
- Sleep(50);
- }
- }
- bool ColorMatch(COLORREF pixel) //making a function to store the pixel color in
- {
- int r = GetRValue(pixel);
- int g = GetGValue(pixel);
- int b = GetBValue(pixel);
- //Check pixel color to see if head is found
- if(SETTR == "1") //if option one is chosen
- {
- if(r == 232 && g == 194 && b == 47 || r == 88 && g == 93 && b == 80) //find white or yellow pixels for phantom forces headshots
- {
- return true; //if that is true return true
- }
- }
- //Check pixel color to see if body is found
- else if(SETTR == "2") //if option two is chosen
- {
- if(r == 68 && g == 68 && b == 68 || r == 86 && g == 47 && b == 17) //find body color pixels for phantom forces body shots
- {
- return true; //if that is true return true
- }
- }
- return false; //if thats not found then return false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement