Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma comment(lib,"user32.lib")
- #pragma comment(lib,"gdiplus.lib")
- #include <windows.h>
- #include <stdio.h>
- #include <iostream>
- #include <string>
- #include <cmath>
- #include <math.h>
- #include <Gdiplus.h>
- #include <stdio.h>
- using namespace Gdiplus;
- using std::string;
- using namespace std;
- //#define PlayerPointer 0x746A18
- #define teamadress 0xFC94C
- #define PlayerPointer 0x1AFFA8
- #define angleXAddress 0x10569A8
- #define angleYAddress 0x10569A4
- //#define enemyBaseAddress 0x746A18 + 24
- #define enemyBaseAddress 0x11D01FC
- #define enemycoordoffset 0x8C
- #define enemyoffset 0x250
- #define onenemybase 0x1211F4
- #define WM_ERASEBKGND 0x0014
- int OnEraseBkgnd()
- {
- return 0;
- }
- DWORD HWDLL;
- DWORD HLEXE;
- DWORD CLDLL;
- bool aimbot = false;
- bool silent = false;
- bool trigger = false;
- bool crosshair = false;
- bool tracers = false;
- bool angle = false;
- bool showmenu = false;
- //string tomsg = "x " + to_string(playerX());
- //MessageBoxA(0, tomsg.c_str(), "Blah blah", 0);
- const double PI = 3.141592653589793238463;
- void LeftClick()
- {
- INPUT input = { 0 };
- // left down
- input.type = INPUT_MOUSE;
- input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
- ::SendInput(1, &input, sizeof(INPUT));
- // left up
- ::ZeroMemory(&input, sizeof(INPUT)); // why zeroMemory? removing this code changes nothing that i can tell
- input.type = INPUT_MOUSE; // why reset this variable? is it not already set?
- input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
- ::SendInput(1, &input, sizeof(INPUT));
- }
- string GetActiveWindowTitle()
- {
- char wnd_title[256];
- HWND hwnd = GetForegroundWindow(); // get handle of currently active window
- GetWindowText(hwnd, wnd_title, sizeof(wnd_title));
- return wnd_title;
- }
- float playerX()
- {
- DWORD PlayerBase = (DWORD)(HWDLL + PlayerPointer - 4); //store the value
- return *(float*)PlayerBase;
- }
- float playerY()
- {
- DWORD PlayerBase = (DWORD)(HWDLL + PlayerPointer - 8); //store the value
- return *(float*)PlayerBase;
- }
- float playerZ()
- {
- DWORD PlayerBase = (DWORD)(HWDLL + PlayerPointer); //store the value
- return *(float*)PlayerBase;
- }
- float angleX()
- {
- DWORD PlayerBase = (DWORD)(HWDLL + angleXAddress); //store the value
- return *(float*)PlayerBase;
- }
- float angleY()
- {
- DWORD PlayerBase = (DWORD)(HWDLL + angleYAddress); //store the value
- return *(float*)PlayerBase;
- }
- float enemyZ(int enemynum)
- {
- int singleadd = enemynum * enemyoffset;
- DWORD PlayerBase = (DWORD)(HWDLL + enemyBaseAddress + enemycoordoffset + singleadd); //store the value
- return *(float*)PlayerBase;
- }
- void nullenemy()
- {
- for (;;) //for (;;) is a loop. So this continues until we close the tread or return the tread (what isn't possible rightnow because its a void)
- {
- for (int i = 0; i < 32; i++)
- {
- int singleadd = i * enemyoffset;
- DWORD PlayerBase = (DWORD)(HWDLL + enemyBaseAddress + enemycoordoffset + singleadd); //store the value
- *(float*)PlayerBase = 0;
- }
- Sleep(100);
- }
- }
- float enemyX(int enemynum)
- {
- int singleadd = enemynum * enemyoffset;
- DWORD PlayerBase = (DWORD)(HWDLL + enemyBaseAddress + enemycoordoffset + singleadd - 4); //store the value
- return *(float*)PlayerBase;
- }
- float enemyY(int enemynum)
- {
- int singleadd = enemynum * enemyoffset;
- DWORD PlayerBase = (DWORD)(HWDLL + enemyBaseAddress + enemycoordoffset + singleadd - 8); //store the value
- return *(float*)PlayerBase;
- }
- bool enemyalive(int enemynum)
- {
- int singleadd = enemynum * enemyoffset;
- DWORD PlayerBase = (DWORD)(HWDLL + enemyBaseAddress + enemycoordoffset + singleadd - 20); //store the value
- int valuebase = *(int*)PlayerBase;
- //string tomsg = to_string(PlayerBase) + "its " + to_string(valuebase);
- //MessageBoxA(0, tomsg.c_str(), "Blah blah", 0);
- if (valuebase == 0)
- return false;
- else
- return true;
- }
- string enemyname(int enemynum)
- {
- int singleadd = enemynum * enemyoffset;
- DWORD PlayerBase = (DWORD)(HWDLL + enemyBaseAddress + singleadd); //store the value
- char cTemp[255];
- string tempstring;
- sprintf_s(cTemp, "%s", PlayerBase);
- tempstring = std::string(cTemp);
- string tomsg = to_string(PlayerBase) + "its " + cTemp;
- MessageBoxA(0, tomsg.c_str(), "Blah blah", 0);
- return tempstring;
- }
- int playerteam()
- {
- DWORD PlayerBase = (DWORD)(CLDLL + teamadress); //store the value
- byte valuebase = *(byte*)PlayerBase;
- if (valuebase == 2)
- return 1;
- else
- return 0;
- //string tomsg = to_string(PlayerBase) + "its " + to_string(valuebase);
- //MessageBoxA(0, tomsg.c_str(), "Blah blah", 0);
- }
- int enemytype(int enemynum)
- {
- int singleadd = enemynum * enemyoffset;
- DWORD PlayerBase = (DWORD)(HWDLL + enemyBaseAddress + singleadd + 44); //store the value
- char cTemp[255];
- string tempstring;
- sprintf_s(cTemp, "%s", PlayerBase);
- tempstring = std::string(cTemp);
- if (tempstring == "gign" || tempstring == "urban" || tempstring == "gsg9" || tempstring == "sas")
- return 0;
- if (tempstring == "arctic" || tempstring == "leet" || tempstring == "guerilla" || tempstring == "terror")
- return 1;
- return 2;
- }
- void changeAngleX(float a)
- {
- DWORD PlayerBase = (DWORD)(HWDLL + angleXAddress); //store the value
- *(float*)PlayerBase = a;
- }
- void changeAngleY(float a)
- {
- DWORD PlayerBase = (DWORD)(HWDLL + angleYAddress); //store the value
- *(float*)PlayerBase = a;
- }
- bool OnEnemy()
- {
- DWORD PlayerBase = (DWORD)(CLDLL + onenemybase); //store the value
- if (*(byte*)PlayerBase == 2)
- return true;
- else
- return false;
- }
- int findClosest(float pXi, float pYi, float pZi)
- {
- double min = 99999999999999;
- int minI = 999;
- float beforeXi = angleX();
- float beforeYi = angleY();
- int pT = playerteam();
- for (int i = 0; i < 32; i++)
- {
- float eXi = enemyX(i);
- float eYi = enemyY(i);
- float eZi = enemyZ(i);
- if (eXi == 0 && eYi == 0 && eZi == 0)
- continue;
- if (pXi == eXi || eYi == pYi)
- continue;
- if (enemyalive(i) == false)
- continue;
- if (pT != enemytype(i))
- continue;
- double diffXi = std::abs(eXi - pXi);
- double diffYi = std::abs(eYi - pYi);
- double diffZi = std::abs(eZi - pZi);
- double dist2di = sqrt(pow(diffXi, 2) + pow(diffYi, 2));
- double dist3di = sqrt(pow(dist2di, 2) + pow(diffZi, 2));
- double aXti = 90 - ((180 / PI) * atan(diffYi / diffXi));
- double aYti = (180 / PI) * atan(diffZi / dist2di);
- if (pZi < eZi)
- aYti = aYti * -1;
- double angtracx;
- double angtracy;
- if (eXi != 0 && eYi != 0 && eZi != 0)
- {
- angtracy = beforeYi - aYti;
- if (eXi < pXi && pYi < eYi)
- {
- angtracx = beforeXi - (360 - aXti);
- }
- if (pXi < eXi && pYi < eYi)
- {
- angtracx = beforeXi - (aXti);
- }
- if (eXi < pXi && eYi < pYi)
- {
- angtracx = beforeXi - (180 + aXti);
- }
- if (pXi < eXi && eYi < pYi)
- {
- angtracx = beforeXi - (180 - aXti);
- }
- if (pYi < eYi && pXi > eXi)
- if (beforeXi > 0 && beforeXi < 180)
- angtracx = angtracx + 360;
- if (pYi < eYi && pXi < eXi)
- if (beforeXi > 180 && beforeXi < 360)
- angtracx = angtracx - 360;
- if (angle == true)
- {
- if (std::abs(angtracx) <= min)
- {
- min = std::abs(angtracx);
- minI = i;
- }
- }
- else
- {
- if (dist3di <= min)
- {
- min = dist3di;
- minI = i;
- }
- }
- }
- }
- return minI;
- }
- void menu() //this is the thread that we have started
- {
- DWORD pdwGduStartup;
- GdiplusStartupInput GdiStartupInp;
- GdiplusStartup(&pdwGduStartup, &GdiStartupInp, NULL);
- LPCSTR LGameWindow = "Counter-Strike";
- HWND hGameWindow = FindWindow(NULL, LGameWindow);
- HDC GDC = GetDC(hGameWindow);
- Graphics graphics(GDC);
- SolidBrush* Brush_Black = new SolidBrush(Gdiplus::Color(255, 0, 0, 0));
- SolidBrush* Brush_White = new SolidBrush(Gdiplus::Color(150, 255, 255, 255));
- SolidBrush* Brush_Enabled = new SolidBrush(Gdiplus::Color(150, 0, 255, 0));
- SolidBrush* Brush_Selected = new SolidBrush(Gdiplus::Color(255, 255, 0, 0));
- Font font(&FontFamily(L"Arial"), 16);
- int resx = 1280;
- double resxd = 1280;
- int resy = 720;
- double resyd = 720;
- int fovx = 90;
- double fovxd = 90;
- int fovy = 74;
- double fovyd = 74;
- int selectedmenu = 1;
- for (;;)
- {
- if (showmenu == true)
- {
- //graphics.DrawRectangle(&pnPen_White, 100, 50, 200, 400);
- //graphics.FillRectangle(Brush_White, 50, 50, 200, 400);
- if (selectedmenu == 1)
- graphics.DrawString(L"Aimbot", -1, &font, PointF(60, 60), Brush_Selected);
- else
- {
- if (aimbot == true)
- graphics.DrawString(L"Aimbot", -1, &font, PointF(60, 60), Brush_Enabled);
- else
- graphics.DrawString(L"Aimbot", -1, &font, PointF(60, 60), Brush_White);
- }
- if (selectedmenu == 2)
- graphics.DrawString(L"Crosshair", -1, &font, PointF(60, 90), Brush_Selected);
- else
- {
- if (crosshair == true)
- graphics.DrawString(L"Crosshair", -1, &font, PointF(60, 90), Brush_Enabled);
- else
- graphics.DrawString(L"Crosshair", -1, &font, PointF(60, 90), Brush_White);
- }
- if (selectedmenu == 3)
- graphics.DrawString(L"SilentAim", -1, &font, PointF(60, 120), Brush_Selected);
- else
- {
- if (silent == true)
- graphics.DrawString(L"SilentAim", -1, &font, PointF(60, 120), Brush_Enabled);
- else
- graphics.DrawString(L"SilentAim", -1, &font, PointF(60, 120), Brush_White);
- }
- if (selectedmenu == 4)
- graphics.DrawString(L"Triggerbot", -1, &font, PointF(60, 150), Brush_Selected);
- else
- {
- if (trigger == true)
- graphics.DrawString(L"Triggerbot", -1, &font, PointF(60, 150), Brush_Enabled);
- else
- graphics.DrawString(L"Triggerbot", -1, &font, PointF(60, 150), Brush_White);
- }
- if (selectedmenu == 5)
- graphics.DrawString(L"Tracers", -1, &font, PointF(60, 180), Brush_Selected);
- else
- {
- if (tracers == true)
- graphics.DrawString(L"Tracers", -1, &font, PointF(60, 180), Brush_Enabled);
- else
- graphics.DrawString(L"Tracers", -1, &font, PointF(60, 180), Brush_White);
- }
- if (selectedmenu == 6)
- graphics.DrawString(L"Anglemode", -1, &font, PointF(60, 210), Brush_Selected);
- else
- {
- if (angle == true)
- graphics.DrawString(L"Anglemode", -1, &font, PointF(60, 210), Brush_Enabled);
- else
- graphics.DrawString(L"Anglemode", -1, &font, PointF(60, 210), Brush_White);
- }
- if (GetAsyncKeyState(VK_DOWN) & 1)
- {
- if ((selectedmenu+1) < 7)
- selectedmenu++;
- }
- if (GetAsyncKeyState(VK_UP) & 1)
- {
- if ((selectedmenu - 1) > 0)
- selectedmenu--;
- }
- if (GetAsyncKeyState(VK_RIGHT) & 1)
- {
- if (selectedmenu == 1)
- {
- if (aimbot == false)
- aimbot = true;
- }
- if (selectedmenu == 2)
- {
- if (crosshair == false)
- crosshair = true;
- }
- if (selectedmenu == 3)
- {
- if (silent == false)
- silent = true;
- }
- if (selectedmenu == 4)
- {
- if (trigger == false)
- trigger = true;
- }
- if (selectedmenu == 5)
- {
- if (tracers == false)
- tracers = true;
- }
- if (selectedmenu == 6)
- {
- if (angle == false)
- angle = true;
- }
- }
- if (GetAsyncKeyState(VK_LEFT) & 1)
- {
- if (selectedmenu == 1)
- {
- if (aimbot == true)
- aimbot = false;
- }
- if (selectedmenu == 2)
- {
- if (crosshair == true)
- crosshair = false;
- }
- if (selectedmenu == 3)
- {
- if (silent == true)
- silent = false;
- }
- if (selectedmenu == 4)
- {
- if (trigger == true)
- trigger = false;
- }
- if (selectedmenu == 5)
- {
- if (tracers == true)
- tracers = false;
- }
- if (selectedmenu == 6)
- {
- if (angle == true)
- angle = false;
- }
- }
- }
- }
- }
- void tracerloop() //this is the thread that we have started
- {
- DWORD pdwGduStartup;
- GdiplusStartupInput GdiStartupInp;
- GdiplusStartup(&pdwGduStartup, &GdiStartupInp, NULL);
- Pen pnPen_Red(Gdiplus::Color(255, 255, 0, 0), 2.0F);
- Pen pnPen_Green(Gdiplus::Color(255, 0, 255, 0), 2.0F);
- Pen pnPen_Blue(Gdiplus::Color(255, 0, 0, 255), 2.0F);
- LPCSTR LGameWindow = "Counter-Strike";
- HWND hGameWindow = FindWindow(NULL, LGameWindow);
- HDC GDC = GetDC(hGameWindow);
- Graphics graphics(GDC);
- Font font(&FontFamily(L"Arial"), 24);
- SolidBrush* Brush_Red = new SolidBrush(Gdiplus::Color(100, 255, 0, 0));
- SolidBrush* Brush_Blue = new SolidBrush(Gdiplus::Color(100, 0, 0, 255));
- int resx = 1280;
- double resxd = 1280;
- int resy = 720;
- double resyd = 720;
- int fovx = 90;
- double fovxd = 90;
- int fovy = 74;
- double fovyd = 74;
- for (;;)
- {
- float pXi = playerX();
- float pYi = playerY();
- float pZi = playerZ();
- float beforeXi = angleX();
- float beforeYi = angleY();
- for (int i = 0; i < 32; i++)
- {
- float eXi = enemyX(i);
- float eYi = enemyY(i);
- float eZi = enemyZ(i);
- //string eN = enemyname(i);
- //MessageBoxA(0, eN.c_str(), "Blah blah", 0);
- if (eXi == 0 && eYi == 0 && eZi == 0)
- continue;
- if (pXi == eXi || eYi == pYi)
- continue;
- double diffXi = std::abs(eXi - pXi);
- double diffYi = std::abs(eYi - pYi);
- double diffZi = std::abs(eZi - pZi);
- double dist2di = sqrt(pow(diffXi, 2) + pow(diffYi, 2));
- double dist3di = sqrt(pow(dist2di, 2) + pow(diffZi, 2));
- double aXti = 90 - ((180 / PI) * atan(diffYi / diffXi));
- double aYti = (180 / PI) * atan(diffZi / dist2di);
- if (pZi < eZi)
- aYti = aYti * -1;
- double angtracx;
- double angtracy;
- if (eXi != 0 && eYi != 0 && eZi != 0)
- {
- angtracy = beforeYi - aYti;
- if (eXi < pXi && pYi < eYi)
- {
- angtracx = beforeXi - (360 - aXti);
- }
- if (pXi < eXi && pYi < eYi)
- {
- angtracx = beforeXi - (aXti);
- }
- if (eXi < pXi && eYi < pYi)
- {
- angtracx = beforeXi - (180 + aXti);
- }
- if (pXi < eXi && eYi < pYi)
- {
- angtracx = beforeXi - (180 - aXti);
- }
- if (tracers == true)
- {
- if (pYi < eYi && pXi > eXi)
- if (beforeXi > 0 && beforeXi < 180)
- angtracx = angtracx + 360;
- if (pYi < eYi && pXi < eXi)
- if (beforeXi > 180 && beforeXi < 360)
- angtracx = angtracx - 360;
- double xdr = fovxd / resxd;
- double xdrc = angtracx / xdr;
- xdrc = xdrc*0.9;
- int tomovx = (int)floor(xdrc);
- tomovx = (resx / 2) + tomovx;
- double ydr = fovyd / resyd;
- double ydrc = angtracy / ydr;
- ydrc = ydrc*1.1;
- int tomovy = (int)floor(ydrc);
- tomovy = tomovy*-1;
- tomovy = (resy / 2) + tomovy;
- //graphics.DrawLine(&pnPen_Green, (resx / 2), (resy / 2), tomovx, tomovy);
- int drawx = tomovx - (int)floor(9050 / dist3di);
- int wd = (int)floor(18100 / dist3di);
- int hd = (int)floor(36000 / dist3di);
- if (enemyalive(i) == true)
- {
- //LinearGradientBrush brush(Rect(0, 0, 100, 100), Color::Red, Color::Yellow, LinearGradientModeHorizontal);
- //graphics.DrawString(L"hey", -1, &font, PointF(drawx, tomovy), myBrush);
- //graphics.DrawString(L"Look at this text!", -1, &font, PointF(drawx, tomovy), &brush);
- if (enemytype(i) == 1)
- {
- graphics.FillRectangle(Brush_Red, drawx, tomovy, wd, hd);
- //graphics.DrawRectangle(&pnPen_Red, drawx, tomovy, wd, hd);
- graphics.DrawLine(&pnPen_Red, (resx / 2), resy, tomovx, tomovy);
- }
- if (enemytype(i) == 0)
- {
- graphics.FillRectangle(Brush_Blue, drawx, tomovy, wd, hd);
- //graphics.DrawRectangle(&pnPen_Blue, drawx, tomovy, wd, hd);
- graphics.DrawLine(&pnPen_Blue, (resx / 2), resy, tomovx, tomovy);
- }
- }
- }
- }
- }
- Sleep(5);
- }
- }
- void loop() //this is the thread that we have started
- {
- int resx = 1280;
- double resxd = 1280;
- int resy = 720;
- double resyd = 720;
- int fovx = 90;
- double fovxd = 90;
- int fovy = 74;
- double fovyd = 74;
- DWORD pdwGduStartup;
- GdiplusStartupInput GdiStartupInp;
- GdiplusStartup(&pdwGduStartup, &GdiStartupInp, NULL);
- Pen pnPen_Blue(Gdiplus::Color(255, 0, 0, 255), 2.0F);
- Pen pnPen_Green(Gdiplus::Color(255, 255, 0, 255), 2.0F);
- LPCSTR LGameWindow = "Counter-Strike";
- HWND hGameWindow = FindWindow(NULL, LGameWindow);
- Graphics graphics(GetDC(hGameWindow));
- for (;;) //for (;;) is a loop. So this continues until we close the tread or return the tread (what isn't possible rightnow because its a void)
- {
- if (crosshair == true)
- {
- graphics.DrawLine(&pnPen_Blue, (resx / 2), ((resy / 2) - 40), (resx / 2), ((resy / 2) + 40));
- graphics.DrawLine(&pnPen_Blue, ((resx / 2) - 40), (resy / 2), ((resx / 2) + 40), (resy / 2));
- }
- if (GetAsyncKeyState(VK_DELETE) & 1)
- {
- showmenu = true;
- }
- if (GetAsyncKeyState(VK_END) & 1)
- {
- showmenu = false;
- }
- float pX = playerX();
- float pY = playerY();
- float pZ = playerZ();
- int close = findClosest(pX, pY, pZ);
- float eX = enemyX(close);
- float eY = enemyY(close);
- float eZ = enemyZ(close);
- double diffX = std::abs(eX - pX);
- double diffY = std::abs(eY - pY);
- double diffZ = std::abs(eZ - pZ);
- double dist2d = sqrt(pow(diffX, 2) + pow(diffY, 2));
- double dist3d = sqrt(pow(dist2d, 2) + pow(diffZ, 2));
- double aXt = 90 - ((180 / PI) * atan(diffY / diffX));
- double aYt = (180 / PI) * atan(diffZ / dist2d);
- if (pZ < eZ)
- aYt = aYt * -1;
- float beforeX = angleX();
- float beforeY = angleY();
- if (aimbot == true)
- if ((GetAsyncKeyState(0x46) && silent == false) || (GetAsyncKeyState(VK_LBUTTON) && silent == true)) {
- if (enemyalive(close) == true && close != 999)
- if (eX != 0 && eY != 0 && eZ != 0)
- {
- if (eX < pX && pY < eY)
- {
- changeAngleX((float)(360 - aXt));
- }
- if (pX < eX && pY < eY)
- {
- changeAngleX((float)(aXt));
- }
- if (eX < pX && eY < pY)
- {
- changeAngleX((float)(180 + aXt));
- }
- if (pX < eX && eY < pY)
- {
- changeAngleX((float)(180 - aXt));
- }
- changeAngleY((float)aYt);
- if (silent == true)
- {
- Sleep(10);
- changeAngleX(beforeX);
- changeAngleY(beforeY);
- }
- }
- }
- if (trigger)
- {
- if (GetActiveWindowTitle() == "Counter-Strike")
- {
- bool toshoot = OnEnemy();
- if (toshoot)
- {
- LeftClick();
- Sleep(50);
- }
- }
- }
- Sleep(1);
- }
- }
- BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpvReserved) //dll starts here
- {
- if (dwReason == DLL_PROCESS_ATTACH) //once it attaches its gonna run this code
- {
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)loop, 0, 0, 0); //starts a new thread
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)tracerloop, 0, 0, 0); //starts a new thread
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)menu, 0, 0, 0); //starts a new thread
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)nullenemy, 0, 0, 0); //starts a new thread
- HWDLL = (DWORD)GetModuleHandle("hw.dll");
- HLEXE = (DWORD)GetModuleHandle("hl.exe");
- CLDLL = (DWORD)GetModuleHandle("client.dll");
- MessageBoxA(0, "QUACK!", 0, 0); //showing the messagebox
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement