Advertisement
vovan333

Main.cpp

Jun 2nd, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include "KeInterface.h"
  3. using namespace std;
  4.  
  5. #define VK_FOV_RESET      VK_NUMPAD7
  6. #define VK_FOV_INCREMENT  0x54
  7. #define VK_FOV_DECREMENT  0x59
  8. #define VK_BHOP_JUMP      VK_SPACE
  9. #define VK_PRINT_OFFSETS  VK_NUMPAD9
  10.  
  11. KeInterface mm("\\\\.\\kernelhop");
  12.  
  13. DWORD pid = mm.GetTargetPid();
  14. DWORD a_clientDll = mm.GetClientModule();
  15. DWORD a_pLocalPlayer = a_clientDll + 0xAA8FDC;
  16.  
  17. void MmWrite(DWORD address, DWORD value)
  18. {
  19.     mm.WriteVirtualMemory(pid, address, value, sizeof(value));
  20. }
  21.  
  22. template <class T> T MmRead(DWORD address)
  23. {
  24.     return mm.ReadVirtualMemory<T>(pid, address, sizeof(T));
  25. }
  26.  
  27. DWORD a_localPlayer()
  28. {
  29.     return MmRead<DWORD>(a_pLocalPlayer);
  30. }
  31.  
  32. void PrintOffsets()
  33. {
  34.     cout << "Debug information:" << endl;
  35.     cout << "a_clientDll:   0x" << hex << a_clientDll << endl;
  36.     cout << "a_pLocalPlayer 0x" << hex << a_pLocalPlayer << endl;
  37.     cout << "a_localPlayer: 0x" << hex << a_localPlayer() << endl;
  38. }
  39.  
  40. bool IsOnGround()
  41. {
  42.     return MmRead<DWORD>(a_localPlayer() + 0x014C) != -1;
  43. }
  44.  
  45. void Jump()
  46. {
  47.     if (a_localPlayer() != 0x0)
  48.     {
  49.         MmWrite(a_clientDll + 0x4F1C354, 5);
  50.         Sleep(50);
  51.         MmWrite(a_clientDll + 0x4F1C354, 4);
  52.         cout << "Jumping..." << endl;
  53.     }
  54. }
  55.  
  56. class FOV
  57. {
  58.     DWORD Value;
  59.     DWORD DefaultValue = 120;
  60.  
  61.     DWORD a_m_iFOV()
  62.     {
  63.         return a_localPlayer() + 0x31D4;
  64.     };
  65.  
  66.     DWORD a_m_iFOVStart()
  67.     {
  68.         return a_localPlayer() + 0x31D8;
  69.     };
  70.  
  71.     DWORD a_m_iFOVDefault()
  72.     {
  73.         return a_localPlayer() + 0x332C;
  74.     };
  75.  
  76.     void Set(DWORD fov)
  77.     {
  78.         if (fov >= 10 && fov <= 150 && a_localPlayer() != 0x0)
  79.         {
  80.             cout << "Setting FOV: " << fov << endl;
  81.             Value = fov;
  82.             MmWrite(a_m_iFOVDefault(), fov);
  83.         }
  84.     }
  85.  
  86.     public:
  87.  
  88.     DWORD Step;
  89.  
  90.     FOV(DWORD step = 20)
  91.     {
  92.         Reset();
  93.         Step = step;
  94.     }
  95.  
  96.     void Reset()
  97.     {
  98.         Set(DefaultValue);
  99.     }
  100.  
  101.     DWORD operator =(DWORD fov)
  102.     {
  103.         Set(fov);
  104.         return Value;
  105.     }
  106.  
  107.     DWORD operator ++(int)
  108.     {
  109.         Set(Value + Step);
  110.         return Value;
  111.     }
  112.  
  113.     DWORD operator --(int)
  114.     {
  115.         Set(Value - Step);
  116.         return Value;
  117.     }
  118.  
  119.     operator DWORD()
  120.     {
  121.         return Value;
  122.     }
  123. };
  124.  
  125. int main()
  126. {
  127.     cout << "Hack has started\n";
  128.     FOV fov;
  129.  
  130.     while (true)
  131.     {
  132.         if (GetAsyncKeyState(VK_FOV_INCREMENT))
  133.         {
  134.             fov ++;
  135.             Sleep(200);
  136.         }
  137.         if (GetAsyncKeyState(VK_FOV_DECREMENT))
  138.         {
  139.             fov --;
  140.             Sleep(200);
  141.         }
  142.         if (GetAsyncKeyState(VK_FOV_RESET))
  143.         {
  144.             fov.Reset();
  145.             Sleep(200);
  146.         }
  147.         if (GetAsyncKeyState(VK_BHOP_JUMP))
  148.         {
  149.             if (IsOnGround())
  150.             {
  151.                 Jump();
  152.             }
  153.         }
  154.         if (GetAsyncKeyState(VK_PRINT_OFFSETS))
  155.         {
  156.             PrintOffsets();
  157.             Sleep(200);
  158.         }
  159.     }
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement