Advertisement
keybode

css v34 dynamic esp box

Feb 13th, 2015
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.06 KB | None | 0 0
  1. void DynamicBox(C_CSPlayer* pEntity) {
  2.     if (!pEntity)
  3.         return;
  4.  
  5.     if (pEntity == HL2::GetLocalPlayer())
  6.         return;
  7.    
  8.     if (pEntity->GetNetworkable()->IsDormant())
  9.         return;
  10.  
  11.     if (pEntity->IsDead())
  12.         return;
  13.  
  14.     Color color = Color::White();
  15.  
  16.     if (pEntity->GetTeamNum() == 2)
  17.         color = Color::Red();
  18.     else if (pEntity->GetTeamNum() == 3)
  19.         color = Color::Cyan();
  20.  
  21.     const matrix3x4_t& trans = *(matrix3x4_t*)(pEntity + HL2::Dynamic::Entity::m_rgflCoordinateFrame);
  22.  
  23.     Vector3 min = *(Vector3*)(pEntity + HL2::Dynamic::Entity::m_Collision + HL2::Dynamic::Entity::m_vecMins);
  24.     Vector3 max = *(Vector3*)(pEntity + HL2::Dynamic::Entity::m_Collision + HL2::Dynamic::Entity::m_vecMaxs);
  25.  
  26.     max.z += 10;
  27.  
  28.     Vector3 pointList[] = {
  29.         Vector3(min.x, min.y, min.z),
  30.         Vector3(min.x, max.y, min.z),
  31.         Vector3(max.x, max.y, min.z),
  32.         Vector3(max.x, min.y, min.z),
  33.         Vector3(max.x, max.y, max.z),
  34.         Vector3(min.x, max.y, max.z),
  35.         Vector3(min.x, min.y, max.z),
  36.         Vector3(max.x, min.y, max.z)
  37.     };
  38.  
  39.     Vector3 transformed[8];
  40.  
  41.     for (int i = 0; i < 8; i++)
  42.         VectorTransform(pointList[i], trans, transformed[i]);
  43.  
  44.     Vector3 flb, brt, blb, frt, frb, brb, blt, flt;
  45.  
  46.     if (!HL2::WorldToScreen(transformed[3], flb) ||
  47.         !HL2::WorldToScreen(transformed[0], blb) ||
  48.         !HL2::WorldToScreen(transformed[2], frb) ||
  49.         !HL2::WorldToScreen(transformed[6], blt) ||
  50.         !HL2::WorldToScreen(transformed[5], brt) ||
  51.         !HL2::WorldToScreen(transformed[4], frt) ||
  52.         !HL2::WorldToScreen(transformed[1], brb) ||
  53.         !HL2::WorldToScreen(transformed[7], flt))
  54.         return;
  55.  
  56.     Vector3 arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
  57.  
  58.     float left = flb.x;
  59.     float top = flb.y;
  60.     float right = flb.x;
  61.     float bottom = flb.y;
  62.  
  63.     for (int i = 0; i < 8; i++) {
  64.         if (left > arr[i].x)
  65.             left = arr[i].x;
  66.         if (top < arr[i].y)
  67.             top = arr[i].y;
  68.         if (right < arr[i].x)
  69.             right = arr[i].x;
  70.         if (bottom > arr[i].y)
  71.             bottom = arr[i].y;
  72.     }
  73.  
  74.     float x = left;
  75.     float y = bottom;
  76.  
  77.     float w = right - left;
  78.     float h = top - bottom;
  79.  
  80.     gRenderer.DrawBorderBoxOut(x, y, w, h, 1, color, Color::Black());
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement