Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #define STR_MERGE_IMPL(a, b) a##b
- #define STR_MERGE(a, b) STR_MERGE_IMPL(a, b)
- #define MAKE_PAD(size) STR_MERGE(_pad, __COUNTER__)[size]
- #define DEFINE_MEMBER_N(type, name, offset) struct {unsigned char MAKE_PAD(offset); type name;}
- struct vec3 {
- float x, y, z;
- // overload operators
- vec3 operator+(vec3 d) {
- return { this->x + d.x , this->y + d.y, this->z + d.z };
- }
- vec3 operator-(vec3 d) {
- return { this->x - d.x , this->y - d.y, this->z - d.z };
- }
- vec3 operator*(float d) {
- return { this->x * d, this->y * d, this->z * d };
- }
- };
- class Ent {
- public:
- union {
- DEFINE_MEMBER_N(int, iShotsFired, 0xA380);
- DEFINE_MEMBER_N(vec3, aimPunchAngle, 0x302C);
- };
- };
- // offsets
- DWORD dwLocalPlayer = 0xD29B1C;
- DWORD dwClientState = 0x588D9C;
- DWORD dwClientState_ViewAngles = 0x4D88;
- // settings
- DWORD uninjectKey = VK_ESCAPE; // key to uninject dll
- float rcsAmnt = 2; // 0 <-> 2
- DWORD WINAPI HackThread(HMODULE hModule) { // main thread
- uintptr_t engineModule = (uintptr_t)GetModuleHandle(L"engine.dll"); // location of engine module
- uintptr_t clientModule = (uintptr_t)GetModuleHandle(L"client_panorama.dll"); // location of client module
- Ent* localPlayer = *(Ent**)(clientModule + dwLocalPlayer); // localPlayer pointer
- vec3* viewAngles = (vec3*)(*(uintptr_t*)(engineModule + dwClientState) + dwClientState_ViewAngles); // pointer to our view angles
- vec3 oPunch{ 0, 0, 0 }; // old Punch
- while (!GetAsyncKeyState(uninjectKey)) { // loop until we click key and then end
- vec3 punchAngle = localPlayer->aimPunchAngle * 2; // get frozen punch angle not changing
- if (localPlayer->iShotsFired > 1) { // if were currently shooting our gun
- vec3 newAngle = *viewAngles + oPunch - punchAngle; // current angles + last Punch - thisPunch
- while (newAngle.y > 180) { newAngle.y -= 360; } // normalize horiz
- while (newAngle.y < -180) { newAngle.y += 360; } // ^
- if (newAngle.x > 89.0f) { newAngle.x = 89.0f; } // normalize vert
- if (newAngle.x < -89.0f) { newAngle.x = -89.0f; } // ^
- *viewAngles = newAngle; // set our view angles to new angle
- }
- oPunch = punchAngle; // set our last punch to this punch
- }
- FreeLibraryAndExitThread(hModule, 0); // free dll if we exit
- return 0;
- }
- BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) {
- if (reason == DLL_PROCESS_ATTACH)
- CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)HackThread, hModule, 0, nullptr); // create our thread if we attach
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement