SHARE
TWEET

Untitled

a guest Jul 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
  2. #include "pch.h"
  3. #include <string>
  4. #include "Structs.h"
  5. #define HOOK_ADDRESS
  6.  
  7. std::string text = "Fetthook";
  8. DWORD dwRenderText = 0x0041A150;
  9. DWORD JumpBack;
  10. Player* localPlayer = (Player*)0x029EA740;
  11. EntityList* entList = (EntityList*)0x0050F4F8;
  12.  
  13. void SimpleJMP(BYTE* pAddress, DWORD dwJumpTo, DWORD size) {
  14.     DWORD dwOldProtect, dwOldProtect2;
  15.     VirtualProtect(pAddress, size, PAGE_EXECUTE_READWRITE, &dwOldProtect);
  16.     auto dwRelAddr = (DWORD)(dwJumpTo - (DWORD)pAddress) - 5;
  17.     *pAddress = 0xE9;
  18.     *((DWORD*)(pAddress + 0x1)) = dwRelAddr;
  19.     VirtualProtect(pAddress, size, dwOldProtect, &dwOldProtect2);
  20. }
  21.  
  22. void onAimbot() {
  23.    
  24.     if (GetAsyncKeyState(0x05)) {
  25.         Vector3 headFromEnemy = entList->list[1]->head;
  26.         Vector3 ourHead = localPlayer->head;
  27.  
  28.  
  29.         Vector3 vecDirection = headFromEnemy - ourHead;
  30.         //vecDirection.Normalize();
  31.         Vector2 vecViewAngle;
  32.  
  33.         if (vecDirection.x == 0 && vecDirection.y == 0 && false) {
  34.             vecViewAngle.y = 0; //yaw
  35.             if (vecDirection.z > 0) {
  36.                 vecViewAngle.x = 270;
  37.             }
  38.             else {
  39.                 vecViewAngle.x = 90;
  40.             }
  41.         }
  42.         else {
  43.             vecViewAngle.y = -atan2(vecDirection.x, vecDirection.y) / PI * 180 + 180;
  44.  
  45.             float tmp = sqrtf(powf(vecDirection.x, 2) + powf(vecDirection.y, 2));
  46.             vecViewAngle.x = (atan2(vecDirection.z, tmp) * 180 / PI);
  47.         }
  48.  
  49.         //vecViewAngle.Normalize();
  50.  
  51.         //localPlayer.pitch = vecViewAngle.x;
  52.         //localPlayer.yaw = vecViewAngle.y;
  53.  
  54.         localPlayer->pitch = vecViewAngle.x;
  55.         localPlayer->yaw = vecViewAngle.y;
  56.     }
  57.    
  58. }
  59.  
  60. void RenderText(const char* text, int x, int y) {
  61.     _asm {
  62.         mov eax, 0xFF
  63.         push - 1
  64.         push - 1
  65.         push 0x00
  66.         push 0x00
  67.         push y
  68.         push x
  69.         push text
  70.         call dwRenderText
  71.         add esp, 1Ch
  72.     }
  73. }
  74.  
  75. __declspec(naked) void Hook() {
  76.     _asm pushad;
  77.     RenderText(text.c_str(), 100, 100);
  78.     onAimbot();
  79.     _asm
  80.     {
  81.         popad;
  82.         mov eax, 0FFh;
  83.         jmp [JumpBack];
  84.     }
  85. }
  86.  
  87. BOOL APIENTRY DllMain( HMODULE hModule,
  88.                        DWORD  ul_reason_for_call,
  89.                        LPVOID lpReserved
  90.                      )
  91. {
  92.     switch (ul_reason_for_call)
  93.     {
  94.     case DLL_PROCESS_ATTACH:
  95.         JumpBack = 0x0040BA4A + 5;
  96.         SimpleJMP((PBYTE)0x0040BA4A, (DWORD)Hook, 5);
  97.     case DLL_THREAD_ATTACH:
  98.     case DLL_THREAD_DETACH:
  99.     case DLL_PROCESS_DETACH:
  100.         break;
  101.     }
  102.     return TRUE;
  103. }
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