Solved Colour Aimbot.

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Crazywink

Hacker
Meme Tier VIP
Dank Tier Donator
Jul 18, 2012
626
4,613
17
crazywink said:
C++:
if((int) pPixels[p].rgbRed < 30 && (int)pPixels[p].rgbGreen < 30 && (int)pPixels[p].rgbBlue > 215)
  {
    system("pause");
    return true;
  }
I don't think you need this part at all. Would explain why it's getting hung up. Try commenting this out and running it. :)

Sorry, what I meant to say is try commenting out the
C++:
system("pause");
from the above code. :)

So it should be:
C++:
if((int) pPixels[p].rgbRed < 30 && (int)pPixels[p].rgbGreen < 30 && (int)pPixels[p].rgbBlue > 215)
  {
    return true;
  }
The system("pause"); was pausing before it returned the value. :)
 

Fleep

Founder
Meme Tier VIP
May 20, 2012
572
11,023
6
I can only assume that you are somehow skipping the main part of the program e.g. not calling a function.
Post your code if you want us to figure out the problem.

Fleep
 

dunk

Newbie
Full Member
Jul 16, 2012
32
322
0
C++:
#include "ScanContents.h"

bool TakeScreenshot(std::string WindowToFind, BITMAP &bm, HBITMAP &hbmap, BITMAPINFO &bmi, HDC &hdcShot, HBITMAP &hbitmapOld, HWND &hwnd);

void SetupBitmapInfo(BITMAPINFO &bmi, int bWidth, int bHeight, int bitsPerPixel);
bool CompareColour(RGBQUAD * pPixels, int height, int width, int x, int y);
void ScanBMP(ScanContents * scan);
bool Aim_Bot(HWND appWnd, std::string GameWindow);
MouseCoord CurrentMouseXY(0, 0);


int main()
{
	std::string GameWindow = "rgb - Windows Photo Viewer";
	HWND appWnd = FindWindow(0, GameWindow.c_str());

	while(!appWnd)
	{
		system ("CLS");
		appWnd = FindWindow(0, GameWindow.c_str());
	  std::cout << "Unable to find" << GameWindow.c_str() << std::endl;
	  Sleep(500);

	}

	  POINT currentPos;
		GetCursorPos(& currentPos);
		CurrentMouseXY.X = currentPos.x;
		CurrentMouseXY.Y = currentPos.y;

		Aim_Bot(appWnd, GameWindow);
		system("pause");
		return 0;

}

bool TakeScreenshot(std::string WindowToFind, BITMAP &bm, HBITMAP &hbmap, BITMAPINFO &bmi, HDC &hdcShot, HBITMAP &hbitmapOld, HWND &hwnd)
{
	RECT rc;
	GetWindowRect(hwnd, &rc);

	hdcShot = CreateCompatibleDC(0);
	hbmap = CreateCompatibleBitmap(GetDC(0), rc.right - rc.left, rc.bottom - rc.top);
	SelectObject(hdcShot, hbmap);

	BitBlt(hdcShot, 0, 0, rc.right - rc.left, rc.bottom - rc.top, GetDC(0), rc.left, rc.top, SRCCOPY);

	if(!GetObject(hbmap, sizeof(BITMAP), (LPSTR)&bm))
		return false;

	int bitsPerPixel = bm.bmBitsPixel;

	if(bitsPerPixel != 32 || bm.bmPlanes != 1)
		return false;
	SetupBitmapInfo(bmi, bm.bmWidth, bm.bmHeight, bitsPerPixel);
	return true;
}

bool Aim_Bot(HWND appWnd, std::string GameWindow)
{
	RECT rcWindow;
	GetWindowRect(appWnd, &rcWindow);
	BITMAP bm;
	HBITMAP hbmap;
	HBITMAP hbmapOld;
	BITMAPINFO bmi;
	HDC hdcShot;
	HDC hdcScreen;

	RGBQUAD * pPixels;

	int TimeTakenSrceenAndScan;
	while(true)
	{
		if(!GetAsyncKeyState('X'))
		{
			TimeTakenSrceenAndScan = clock();
			
			 if(TakeScreenshot(GameWindow, bm, hbmap, bmi, hdcShot, hbmapOld, appWnd))
				 break;

		
			 HBITMAP hbmapNew = CreateCompatibleBitmap(hdcShot, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top);

			 HDC hdcShotNew = CreateCompatibleDC(hdcShot);

			 HBITMAP OldBmp = (HBITMAP) SelectObject(hdcShotNew, hbmapNew);

			 BitBlt(hdcShotNew, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, hdcShot, 0, 0, SRCCOPY);

			 pPixels = new RGBQUAD[bm.bmWidth * bm.bmHeight];
			 if(!pPixels)return false;

			 SelectObject(hdcShotNew, OldBmp);

			 if(!GetDIBits(hdcShotNew, hbmapNew, 0, bm.bmHeight, pPixels, &bmi, DIB_RGB_COLORS))
			 {
				 ReleaseDC(appWnd, hdcShot);
				 delete[] pPixels;
				 return false;
			 }
			 ReleaseDC(appWnd, hdcShot);

			 ScanContents scanContentsMain(bm, rcWindow, pPixels);

			 ScanBMP(&scanContentsMain);

			 if(pPixels)
				 free(pPixels);
			 SelectObject(hdcShot, hbmapOld);
			 DeleteObject(hbmap);
			 DeleteDC(hdcShot);
			 DeleteObject(hbmapNew);
			 DeleteObject(OldBmp);
			 DeleteDC(hdcShotNew);
			 std::cout << "out of scan, took" << clock() - TimeTakenSrceenAndScan << "milliseconds" << std::endl;
		}
	}
}

void SetupBitmapInfo(BITMAPINFO &bmi, int bWidth, int bHeight, int bitsPerPixel)
{
	bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
	bmi.bmiHeader.biWidth = bWidth;
  bmi.bmiHeader.biHeight = bHeight;
	bmi.bmiHeader.biPlanes = 1;
	bmi.bmiHeader.biBitCount = bitsPerPixel;
	bmi.bmiHeader.biCompression = BI_RGB;
	bmi.bmiHeader.biSizeImage = 0;
}

void ScanBMP(ScanContents * scan)
{
	for(int y = (scan->RcWindow.bottom - scan->RcWindow.top)/2;
		y < ((scan->RcWindow.bottom - scan->RcWindow.top) - (scan->RcWindow.bottom - scan->RcWindow.top)/3.5);
		y++)
	{
		for(int x = (scan->RcWindow.right - scan->RcWindow.left)/4;
		x < ((scan->RcWindow.right - scan->RcWindow.left) - (scan->RcWindow.right - scan->RcWindow.left)/4);
		x++)
		{
			SetCursorPos(x+scan->RcWindow.left, (y+4)+scan->RcWindow.top);

			if(CompareColour(scan->PPixels, scan->Bm.bmHeight, scan->Bm.bmWidth, x, y))
			{
				SetCursorPos(x+scan->RcWindow.left, (y+4)+scan->RcWindow.top);

				POINT currentPos;
				GetCursorPos(&currentPos);

				//ShootBot (x+scan->RcWindow.left, y+scan->RcWindow.top);

				CurrentMouseXY.X = currentPos.x;
				CurrentMouseXY.Y = currentPos.y;
				return;
			}

		}
	}

}

bool CompareColour(RGBQUAD * pPixels, int height, int width, int x, int y)
{
	int p = (height-y-1)*width+x;

	std::cout << (int)pPixels[p].rgbRed << ", " << (int)pPixels[p].rgbGreen << ", " << (int)pPixels[p].rgbBlue << std::endl;
	Sleep(100);
	if((int) pPixels[p].rgbRed < 30 && (int)pPixels[p].rgbGreen < 30 && (int)pPixels[p].rgbBlue > 215)
	{
		system("pause");
		return true;
	}

	if(GetAsyncKeyState(VK_DELETE))
	{
		exit(0);
	}
	return false;
}
 

Crazywink

Hacker
Meme Tier VIP
Dank Tier Donator
Jul 18, 2012
626
4,613
17
C++:
if((int) pPixels[p].rgbRed < 30 && (int)pPixels[p].rgbGreen < 30 && (int)pPixels[p].rgbBlue > 215)
  {
    system("pause");
    return true;
  }
I don't think you need this part at all. Would explain why it's getting hung up. Try commenting this out and running it. :)
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,188
12,638
76
Also a little tip, if you ever plan to release anything in the future, I recommend staying away from findWindow and using process name instead. Window's names can differ for people depending on programs and parameters given on the program's launch.
Just a tip :)
 

dunk

Newbie
Full Member
Jul 16, 2012
32
322
0
Its still going programm now write me hieroglyphs.
P.S. My Windows is Russian language.
 

Crazywink

Hacker
Meme Tier VIP
Dank Tier Donator
Jul 18, 2012
626
4,613
17
Sorry for the late response, looks like for the window name you included a space in the quotations. Right at the beginning of the quotations. :)
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods League of Legends Accounts