Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.50 KB | None | 0 0
  1. // rustnorecoil.cpp: definisce il punto di ingresso dell'applicazione console.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <thread>
  6. #include <Windows.h>
  7. #include <iostream>
  8. #include <stdio.h>
  9. #include <string>
  10.  
  11. using namespace std;
  12.  
  13. namespace AssaultRifle
  14. {
  15.     const size_t WEAPON = 1;
  16.     const size_t SHOTS = 29;
  17.     DWORD recoilTableY[WEAPON][SHOTS] = {
  18.         { 50, 55, 55, 45, 30, 30, 25, 25, 15, 15, 15, 20, 25, 30, 35, 30, 35, 25, 10, 15, 10, 10, 15, 15, 25, 25, 30, 30, 25 }
  19.     };
  20.     DWORD recoilTableX[WEAPON][SHOTS] = {
  21.         { -35, -10, -60, -50, -5, 15, 20, 45, 40, 30, 75, 5, 40, -35, -25, -35, -30, -25, -35 , -40, -40, -45, -25, 15, 20, 30, 60, 70, 50 }
  22.     };
  23. }
  24.  
  25.  
  26. void UpdateMenu();
  27. void SetColor(int ForgC);
  28. void Toggle();
  29. void Norecoil();
  30. void Semirifle();
  31.  
  32. int Changes = 0;
  33.  
  34.  
  35. bool semirifle = false;
  36. bool norecoil = false;
  37. bool updated = false;
  38.  
  39. string bools[2] = { "[OFF]", "[ON]" };
  40.  
  41. void UpdateMenu()
  42. {
  43.     int temp = -1;
  44.    
  45.    
  46.     if (temp != Changes)
  47.     {
  48.             temp = Changes;
  49.            
  50.             system("cls");
  51.  
  52.             SetColor(15);
  53.             cout << "--- Stupid Rust Cheats ---" << endl;
  54.             cout << "__________________________" << endl << endl;
  55.  
  56.             if (norecoil)
  57.             {
  58.                 SetColor(10);
  59.                 cout << " [F8] AK Ezrecoil\t\t=\t" << bools[norecoil] << endl;
  60.             }
  61.             else
  62.             {
  63.                 SetColor(12);
  64.                 cout << " [F8] AK Ezrecoil\t\t=\t" << bools[norecoil] << endl;
  65.             }
  66.             if (semirifle)
  67.             {
  68.                 SetColor(10);
  69.                 cout << " [F7] Semi Rifle Automatic\t\t=\t" << bools[semirifle] << endl;
  70.             }
  71.             else
  72.             {
  73.                 SetColor(12);
  74.                 cout << " [F7] Semi Rifle Automatic\t\t=\t" << bools[semirifle] << endl;
  75.             }
  76.            
  77.     }
  78.    
  79. }
  80.  
  81. void SetColor(int ForgC)
  82. {
  83.     WORD wColor;
  84.  
  85.     HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
  86.     CONSOLE_SCREEN_BUFFER_INFO csbi;
  87.  
  88.     //We use csbi for the wAttributes word.
  89.     if (GetConsoleScreenBufferInfo(hStdOut, &csbi))
  90.     {
  91.         //Mask out all but the background attribute, and add in the forgournd     color
  92.         wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F);
  93.         SetConsoleTextAttribute(hStdOut, wColor);
  94.     }
  95.     return;
  96. }
  97.  
  98. void Toggle()
  99. {
  100.     if (GetAsyncKeyState(VK_F8))
  101.     {  
  102.         norecoil = !norecoil;
  103.         Changes++;
  104.         updated = true;
  105.         Sleep(100);
  106.     }
  107.     if (GetAsyncKeyState(VK_F9))
  108.     {
  109.         semirifle = !semirifle;
  110.         Changes++;
  111.         updated = true;
  112.         Sleep(100);
  113.     }
  114. }
  115.  
  116. void Norecoil()
  117. {
  118.     if (norecoil)
  119.     {
  120.         size_t iCount = 0;
  121.        
  122.         while (GetAsyncKeyState(1) < 0)
  123.         {
  124.             int x = AssaultRifle::recoilTableX[0][iCount];
  125.             int y = AssaultRifle::recoilTableY[0][iCount];
  126.             int fireRate = 134;
  127.             int xSplit = x / 5;
  128.             int ySplit = y / 5;
  129.             int tSplit = fireRate / 5;
  130.  
  131.             if (iCount < AssaultRifle::SHOTS)
  132.             {
  133.                  
  134.                
  135.                     for (int i = 0; i < 5; i++)
  136.                     {
  137.                         Sleep(tSplit);
  138.                         mouse_event(1u, xSplit, ySplit, 0, 0);
  139.                         if (iCount < AssaultRifle::SHOTS)
  140.                         {
  141.                             if (i == 4)
  142.                             {
  143.                                 iCount++;
  144.                             }
  145.                         }
  146.                     }
  147.                
  148.             }
  149.         }
  150.     }
  151. }
  152.  
  153. void Semirifle()
  154. {  
  155.     const int shots = 15;
  156.     int semishotsfired = 0;
  157.    
  158.     if (semirifle)
  159.    
  160.     {
  161.        
  162.         while (GetAsyncKeyState(0x01) < 0)
  163.         {
  164.             if (semishotsfired < shots)
  165.             {
  166.                 keybd_event(VK_PRIOR, 0, 0, 0);
  167.                 Sleep(5);
  168.                 keybd_event(VK_PRIOR, 0, KEYEVENTF_KEYUP, 0);
  169.                 Sleep(5);
  170.                 mouse_event(1u, 0, 85, 0, 0);
  171.                 Sleep(173);
  172.                 if (semishotsfired < shots) semishotsfired++;
  173.             }
  174.         }
  175.     }
  176. }
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184. int main()
  185. {
  186.     do {
  187.         Semirifle();
  188.         Norecoil();
  189.         Toggle();
  190.         if (updated)
  191.             updated = false;
  192.         UpdateMenu();
  193.         Sleep(100);
  194.        
  195.     } while (updated == false);
  196.     cin.ignore();
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement