Advertisement
vovan333

0xDEADBEEF/Main.cpp

Jun 12th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma comment(lib, "BlackBone.lib")
  2. #include <iostream>
  3. #include "Types.hpp"
  4. #include "Threading.cpp"
  5. #include "FOV.cpp"
  6. #include "Hack.cpp"
  7. using namespace std;
  8.  
  9. Hack hack;
  10. vector<HANDLE> threads;
  11.  
  12. void WaitForGameThenStart();
  13.  
  14. void PrintDebugInfo()
  15. {
  16.     cout << "Debug information: " << endl;
  17.     cout << "hack.ClientDll: 0x" << hex << hack.ClientDll << endl;
  18.     cout << "hack.LocalPlayerPointer: 0x" << hex << hack.LocalPlayerPointer << endl;
  19.     cout << "hack.LocalPlayer(): 0x" << hex << hack.LocalPlayer() << endl;
  20.     cout << "hGameWindow: " << hack.hGameWindow << endl;
  21.     cout << "GetForegroundWindow(): " << GetForegroundWindow() << endl;
  22. }
  23.  
  24. dw BunnyhopThread(void*)
  25. {
  26.     while (true)
  27.     {
  28.         if (GetAsyncKeyState(Key::BhopJump) && hack.IsGameWindowActive() && hack.LocalPlayer())
  29.         {
  30.             if (hack.IsPlayerOnGround())
  31.             {
  32.                 hack.Jump();
  33.             }
  34.         }
  35.     }
  36. }
  37.  
  38. dw RapidFireThread(void*)
  39. {
  40.     while (true)
  41.     {
  42.         if (GetAsyncKeyState(Key::RapidFire) && hack.IsGameWindowActive() && hack.LocalPlayer())
  43.         {
  44.             hack.Attack();
  45.             Sleep(16);
  46.         }
  47.     }
  48. }
  49.  
  50. dw ESPThread(void*)
  51. {
  52.     while (true)
  53.     {
  54.         if (GetAsyncKeyState(Key::RapidFire) && hack.IsGameWindowActive() && hack.LocalPlayer() && (hack.GlowEspEnable || hack.RadarEspEnable))
  55.         {
  56.             hack.IterateAndGlowOrSpot(Color24(0, 255, 0, 255), Color24(255, 0, 0, 255));
  57.         }
  58.     }
  59. }
  60.  
  61. dw GameStateControlThread(void*)
  62. {
  63.     while (true)
  64.     {
  65.         if (hack.IsGameRunning())
  66.         {
  67.             Sleep(1000);
  68.         }
  69.         else
  70.         {
  71.             printf("CS:GO has exited.\n");
  72.             StopThreads(threads);
  73.             threads.clear();
  74.             break;
  75.         }
  76.     }
  77. }
  78.  
  79. dw MiscellanousThread(void* pFOV)
  80. {
  81.     FOV* fov = (FOV*)pFOV;
  82.     while (true)
  83.     {
  84.         if (GetAsyncKeyState(Key::DebugPrint))
  85.         {
  86.             PrintDebugInfo();
  87.             Sleep(200);
  88.         }
  89.         if (hack.IsGameWindowActive())
  90.         {
  91.             if (hack.LocalPlayer())
  92.             {
  93.                 if (GetAsyncKeyState(Key::FovIncrement))
  94.                 {
  95.                     *fov++;
  96.                     Sleep(200);
  97.                 }
  98.                 if (GetAsyncKeyState(Key::FovDecrement))
  99.                 {
  100.                     *fov--;
  101.                     Sleep(200);
  102.                 }
  103.                 if (GetAsyncKeyState(Key::FovReset))
  104.                 {
  105.                     fov->Reset();
  106.                     Sleep(200);
  107.                 }
  108.             }
  109.             if (GetAsyncKeyState(Key::GlowEspToggle))
  110.             {
  111.                 hack.GlowEspEnable = !hack.GlowEspEnable;
  112.                 cout << "GlowESP is now " << (hack.GlowEspEnable ? "enabled" : "disabled") << endl;
  113.                 Sleep(200);
  114.             }
  115.             if (GetAsyncKeyState(Key::GlowEspBloomToggle))
  116.             {
  117.                 hack.GlowEspBloomEnable = !hack.GlowEspBloomEnable;
  118.                 cout << "GlowESP Bloom effect is now " << (hack.GlowEspBloomEnable ? "enabled" : "disabled") << endl;
  119.                 Sleep(200);
  120.             }
  121.             if (GetAsyncKeyState(Key::RadarEspEnable))
  122.             {
  123.                 hack.RadarEspEnable = !hack.RadarEspEnable;
  124.                 cout << "RadarESP is now " << (hack.RadarEspEnable ? "enabled" : "disabled") << endl;
  125.                 Sleep(200);
  126.             }
  127.             hack.SetFlashMaxAlpha(0.0f);
  128.         }
  129.     }
  130. }
  131.  
  132. void RunHackThreads()
  133. {
  134.     hack.InitializeOffsets();
  135.     printf("\n");
  136.     PrintDebugInfo();
  137.     FOV fov(10, &hack);
  138.     printf("\nReady. NumLock MUST be turned ON to activate hack features.\n");
  139.    
  140.     auto miscThread = StartThread(MiscellanousThread, &fov);
  141.     threads = StartThreads({ BunnyhopThread, RapidFireThread, ESPThread});
  142.     threads.push_back(miscThread);
  143.     HANDLE gscThread = StartThread(GameStateControlThread);
  144.     WaitForSingleObject(gscThread, INFINITE);
  145.     CloseHandle(gscThread);
  146.     WaitForGameThenStart();
  147. }
  148.  
  149. void WaitForGame()
  150. {
  151.     while(true)
  152.     {
  153.         bool state = hack.IsGameRunning();
  154.         if (!state)
  155.         {
  156.             Sleep(500);
  157.         }
  158.         else
  159.         {
  160.             printf("CS:GO has started.. Loading hack..\n");
  161.             Sleep(7000);
  162.             break;
  163.         }
  164.     }
  165. }
  166.  
  167. void WaitForGameThenStart()
  168. {
  169.     printf("Waiting for CS:GO to start..\n");
  170.     WaitForGame();
  171.     RunHackThreads();
  172. }
  173.  
  174. int main()
  175. {
  176.     if (hack.DriversLoaded())
  177.     {
  178.         printf("Driver check succeded.\n");
  179.         WaitForGameThenStart();
  180.     }
  181.     else
  182.     {
  183.         printf("Driver check failed. Check if drivers are loaded.");
  184.         Sleep(5000);
  185.         exit(-1);
  186.     }
  187. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement