Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.82 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.         { 44, 48, 50, 46, 31, 31, 24, 24, 16, 13, 14, 20, 26, 32, 34, 29, 33, 23, 12, 14, 10, 12, 17, 15, 25, 28, 30, 27, 26 }
  19.     };
  20.     DWORD recoilTableX[WEAPON][SHOTS] = {
  21.         { -32, -3, -57, -52, -2, 15, 20, 43, 41, 31, 75, 3, 38, -33, -26, -36, -30, -27, -36 , -40, -39, -44, -22, 13, 19, 28, 58, 68, 47 }
  22.     };
  23. }
  24.  
  25.  
  26. void UpdateMenu();
  27. void SetColor(int ForgC);
  28. void Toggle();
  29. void Norecoil();
  30.  
  31.  
  32. int Changes = 0;
  33.  
  34.  
  35.  
  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 << "--- OG_Bozzik#2177 and
  54. Dysfunctional#4011 Recoil Script---" << endl;
  55.             cout << "__________________________" << endl << endl;
  56.  
  57.             if (norecoil)
  58.             {
  59.                 SetColor(10);
  60.                 cout << " [F8] AK Recoil\t\t=\t" << bools[norecoil] << endl;
  61.             }
  62.             else
  63.             {
  64.                 SetColor(12);
  65.                 cout << " [F8] AK Recoil\t\t=\t" << bools[norecoil] << endl;
  66.             }
  67.            
  68.            
  69.     }
  70.    
  71. }
  72.  
  73. void SetColor(int ForgC)
  74. {
  75.     WORD wColor;
  76.  
  77.     HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
  78.     CONSOLE_SCREEN_BUFFER_INFO csbi;
  79.  
  80.     //We use csbi for the wAttributes word.
  81.     if (GetConsoleScreenBufferInfo(hStdOut, &csbi))
  82.     {
  83.         //Mask out all but the background attribute, and add in the forgournd     color
  84.         wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F);
  85.         SetConsoleTextAttribute(hStdOut, wColor);
  86.     }
  87.     return;
  88. }
  89.  
  90. void Toggle()
  91. {
  92.     if (GetAsyncKeyState(VK_F8))
  93.     {  
  94.         norecoil = !norecoil;
  95.         Changes++;
  96.         updated = true;
  97.         Sleep(100);
  98.     }
  99.    
  100. }
  101.  
  102. void Norecoil()
  103. {
  104.     if (norecoil)
  105. {
  106.     size_t iCount = 0;
  107.     int fireRate = 134;
  108.     while (GetAsyncKeyState(1) < 0)
  109.     {
  110.         if (iCount < AssaultRifle::SHOTS)
  111.         {
  112.             mouse_event(1u, AssaultRifle::recoilTableX[0][iCount], AssaultRifle::recoilTableY[0][iCount], 0, 3u);
  113.             Sleep(fireRate);
  114.             if (iCount < AssaultRifle::SHOTS) iCount++;
  115. }
  116. }
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. int main()
  128. {
  129.     do {
  130.         Norecoil();
  131.         Toggle();
  132.         if (updated)
  133.             updated = false;
  134.         UpdateMenu();
  135.         Sleep(100);
  136.        
  137.     } while (updated == false);
  138.     cin.ignore();
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement