daily pastebin goal
68%
SHARE
TWEET

help?

a guest Mar 20th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct coordinate
  2. {
  3.     float x, y, z;
  4. };
  5. struct angel
  6. {
  7.     float x, y, z;
  8. };
  9. angel CalcAngle(coordinate src, coordinate dst);
  10. float Distance(coordinate us, coordinate enemy);
  11.  
  12. void aim()
  13. {
  14.     DWORD engine = readMem<DWORD>(engineBase + dwLocalPlayer);
  15.     DWORD myPlayer = readMem<DWORD>(clientBase + dwLocalPlayer);
  16.     DWORD playerbone = readMem<DWORD>(dwEntityList + m_dwBoneMatrix);
  17.    
  18.     coordinate mypos, myeye, playerhead, playerpos;
  19.     Vector angle;
  20.     int distance;
  21.     double Distance = 100;
  22.     int targets = 0;
  23.     int myTeam;
  24.     int Team;
  25.     int Health;
  26.     bool dormant;
  27.  
  28.     angel ang;
  29.  
  30.     while (true) {
  31.  
  32.         if (GetAsyncKeyState(VK_LBUTTON)) {
  33.  
  34.             //get targets
  35.             for (int i = 0; i < 64; i++) {
  36.                 DWORD entity = readMem<DWORD>(clientBase + dwEntityList + ((i - 1) * 0x10));
  37.  
  38.                 if (entity != NULL) {
  39.                     myTeam = readMem<int>(myPlayer + m_iTeamNum);
  40.                     Team = readMem<int>(entity + m_iTeamNum);
  41.                     Health = readMem<int>(entity + m_iHealth);
  42.                     dormant = readMem<bool>(entity + bDormant);
  43.                 }
  44.  
  45.                 if (dormant || Team == myTeam || Health == 0)
  46.                     continue;
  47.  
  48.                     mypos = readMem<coordinate>(myPlayer + m_vecOrigin);
  49.                     myeye.x = mypos.x + readMem<float>(myPlayer + m_vecViewOffset);
  50.                     myeye.y = mypos.y + readMem<float>(myPlayer + m_vecViewOffset + 4);
  51.                     myeye.z = mypos.z + readMem<float>(myPlayer + m_vecViewOffset + 8);
  52.                     playerbone = readMem<uintptr_t>(entity + m_dwBoneMatrix);
  53.                     playerhead.x = readMem<float>(playerbone + (8 * 0x30) + 0x0C);
  54.                     playerhead.y = readMem<float>(playerbone + (8 * 0x30) + 0x1C);
  55.                     playerhead.z = readMem<float>(playerbone + (8 * 0x30) + 0x2C);
  56.  
  57.                     ang = CalcAngle(myeye, playerhead);
  58.  
  59.                     writeMem<angel>(engine + dwClientState_ViewAngles, ang);
  60.  
  61.  
  62.             }
  63.         }
  64.     }
  65. }
  66.  
  67. angel CalcAngle(coordinate Source, coordinate Destination)
  68. {
  69.     angel angles;
  70.     coordinate delta;
  71.     delta.x = (Source.x - Destination.x);
  72.     delta.y = (Source.y - Destination.y);
  73.     delta.z = (Source.z - Destination.z);
  74.     double hyp = sqrt(delta.x * delta.x + delta.y * delta.y);
  75.     angles.x = (float)(atanf(delta.z / hyp) * 57.295779513082f);
  76.     angles.y = (float)(atanf(delta.y / delta.x) * 57.295779513082f);
  77.     angles.z = 0.0f;
  78.     if (delta.x >= 0.0) { angles.y += 180.0f;}
  79.     return angles;
  80. }
  81. float Distance(coordinate us, coordinate enemy)
  82. {
  83.     float distance = sqrt(pow(enemy.x - us.x, 2) + pow(enemy.y - us.y, 2) + pow(enemy.z - us.z, 2));
  84.     return distance;
  85. }
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