Advertisement
keybode

css v34 intersection triggerbot

Feb 3rd, 2015
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. bool CAimbot::EntityHit(int random_seed, CUserCmd* pCmd) {
  2.     Vector3 viewangles = pCmd->viewangles;
  3.  
  4.     viewangles += HL2::m_pLocalEntity->GetPunchAngle() * 2.0f;
  5.  
  6.     Vector3 vSpread;
  7.  
  8.     gAccuracy.GetSpreadFix(random_seed, pCmd, vSpread);
  9.  
  10.     viewangles -= vSpread;
  11.  
  12.     int iEntityListSize = HL2::m_pEngine->GetMaxClients();
  13.  
  14.     for (int i = 1; i <= iEntityListSize; i++) {
  15.         CBaseEntity* pEntity = HL2::m_pEntList->GetClientEntity(i);
  16.  
  17.         if (!pEntity) {
  18.             continue;
  19.         }
  20.  
  21.         if (pEntity->GetIndex() == HL2::m_pLocalEntity->GetIndex()) {
  22.             continue;
  23.         }
  24.  
  25.         if (pEntity->IsDormant()) {
  26.             continue;
  27.         }
  28.  
  29.         if (pEntity->IsDead()) {
  30.             continue;
  31.         }
  32.  
  33.         Vector3 vHead = pEntity->GetHitboxPosition(12);
  34.  
  35.         if (vHead.IsZero()) {
  36.             continue;
  37.         }
  38.  
  39.         if (!HL2::Visible(vHead, pEntity)) {
  40.             continue;
  41.         }
  42.  
  43.         Vector3 vStart = HL2::m_pLocalEntity->GetEyePosition();
  44.  
  45.         float fDistance = vStart.DistTo(vHead);
  46.  
  47.         Vector3 vEnd;
  48.  
  49.         AngleVector(viewangles, vEnd);
  50.  
  51.         vEnd = vEnd * fDistance + vStart;
  52.  
  53.         Vector3 vMin, vMax;
  54.  
  55.         pEntity->GetHitboxBound(12, vMin, vMax);
  56.  
  57.         if ((min(vMax.x, vMin.x) <= vEnd.x) &&
  58.             (min(vMax.y, vMin.y) <= vEnd.y) &&
  59.             (min(vMax.z, vMin.z) <= vEnd.z) &&
  60.             (max(vMax.x, vMin.x) >= vEnd.x) &&
  61.             (max(vMax.y, vMin.y) >= vEnd.y) &&
  62.             (max(vMax.z, vMin.z) >= vEnd.z)) {
  63.             return true;
  64.         }
  65.     }
  66.  
  67.     return false;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement