SHARE
TWEET

Untitled

a guest Jan 24th, 2020 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Windows.h>
  2.  
  3. #define STR_MERGE_IMPL(a, b) a##b
  4. #define STR_MERGE(a, b) STR_MERGE_IMPL(a, b)
  5. #define MAKE_PAD(size) STR_MERGE(_pad, __COUNTER__)[size]
  6. #define DEFINE_MEMBER_N(type, name, offset) struct {unsigned char MAKE_PAD(offset); type name;}
  7.  
  8. struct vec3 {
  9.     float x, y, z;
  10.  
  11.     // overload operators
  12.     vec3 operator+(vec3 d) {
  13.         return { this->x + d.x , this->y + d.y, this->z + d.z };
  14.     }
  15.     vec3 operator-(vec3 d) {
  16.         return { this->x - d.x , this->y - d.y, this->z - d.z };
  17.     }
  18.     vec3 operator*(float d) {
  19.         return { this->x * d, this->y * d, this->z * d };
  20.     }
  21. };
  22.  
  23. class Ent {
  24. public:
  25.     union {
  26.         DEFINE_MEMBER_N(int, iShotsFired, 0xA380);
  27.         DEFINE_MEMBER_N(vec3, aimPunchAngle, 0x302C);
  28.     };
  29. };
  30.  
  31. // offsets
  32. DWORD dwLocalPlayer = 0xD29B1C;
  33. DWORD dwClientState = 0x588D9C;
  34. DWORD dwClientState_ViewAngles = 0x4D88;
  35.  
  36. // settings
  37. DWORD uninjectKey = VK_ESCAPE; // key to uninject dll
  38. float rcsAmnt = 2; // 0 <-> 2
  39.  
  40. DWORD WINAPI HackThread(HMODULE hModule) { // main thread
  41.     uintptr_t engineModule = (uintptr_t)GetModuleHandle(L"engine.dll"); // location of engine module
  42.     uintptr_t clientModule = (uintptr_t)GetModuleHandle(L"client_panorama.dll"); // location of client module
  43.     Ent* localPlayer = *(Ent**)(clientModule + dwLocalPlayer); // localPlayer pointer
  44.  
  45.     vec3* viewAngles = (vec3*)(*(uintptr_t*)(engineModule + dwClientState) + dwClientState_ViewAngles); // pointer to our view angles
  46.    
  47.     vec3 oPunch{ 0, 0, 0 }; // old Punch
  48.  
  49.     while (!GetAsyncKeyState(uninjectKey)) { // loop until we click key and then end
  50.         vec3 punchAngle = localPlayer->aimPunchAngle * 2; // get frozen punch angle not changing       
  51.  
  52.         if (localPlayer->iShotsFired > 1) { // if were currently shooting our gun
  53.             vec3 newAngle = *viewAngles + oPunch - punchAngle; // current angles + last Punch - thisPunch
  54.  
  55.             while (newAngle.y > 180)  { newAngle.y -=    360; } // normalize horiz
  56.             while (newAngle.y < -180) { newAngle.y +=    360; } // ^
  57.             if (newAngle.x > 89.0f)   { newAngle.x  =  89.0f; } // normalize vert
  58.             if (newAngle.x < -89.0f)  { newAngle.x  = -89.0f; } // ^
  59.  
  60.             *viewAngles = newAngle; // set our view angles to new angle
  61.         }
  62.  
  63.         oPunch = punchAngle; // set our last punch to this punch
  64.     }
  65.  
  66.     FreeLibraryAndExitThread(hModule, 0); // free dll if we exit
  67.     return 0;
  68. }
  69.  
  70. BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) {
  71.     if (reason == DLL_PROCESS_ATTACH)
  72.         CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)HackThread, hModule, 0, nullptr); // create our thread if we attach
  73.     return TRUE;
  74. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top