hlsdk

Murdick

Mar 1st, 2010
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.40 KB | None | 0 0
  1. void CESPPanel::Paint()
  2. {
  3.     if (!m_bDraw)
  4.         return;
  5.  
  6.     Drawing::BeginESPDraw(300,300, Color(200,100,200, 255));
  7.  
  8.     for (int i=0;i<m_pClientEntityList->GetHighestEntityIndex();i++)
  9.     {
  10.         C_BaseEntity* pBaseEntity = Zeus::Entity::GetBaseEntity(i);
  11.         if (!pBaseEntity)
  12.             continue;
  13.         Vector vecOrigin = Zeus::Entity::GetEyePos(pBaseEntity);
  14.         Vector vScreen;
  15.         if(Drawing::WorldToScreen( vecOrigin, vScreen ))
  16.         {
  17.             int hp = Zeus::Entity::GetHealth(pBaseEntity);
  18.             std::string ClassName = Zeus::Entity::TFGetClassName(pBaseEntity);
  19.             int Distance = Zeus::Entity::DistanceTo(pBaseEntity);       // Distance to a player
  20.             std::string dist;
  21.             std::stringstream distout;
  22.             distout << Distance;
  23.             dist = distout.str();
  24.  
  25.             std::string hitpoints;
  26.             std::stringstream hpout;
  27.             hpout << hp;
  28.             hitpoints = hpout.str();
  29.  
  30.             if (Distance<5)
  31.                 Distance=5;
  32.  
  33.             if (hp*2>255)
  34.                 hp=255;
  35.             else
  36.                 hp *= 2;
  37.             if (hp > 1) {       // otherwise it draws for every entity
  38.                 Drawing::DrawOutlinedRect(vScreen.x-(Distance / 2), vScreen.y-(Distance / 2), Distance, Distance, Color(200,200,200,hp));  
  39.                                                                                                     // Box size now dependant on distance
  40.                 Drawing::DrawString(vScreen.x,vScreen.y,Color(200,200,200,hp), ClassName);
  41.                 Drawing::DrawString(vScreen.x,vScreen.y+10,Color(200,200,200,hp), dist);
  42.                 Drawing::DrawString(vScreen.x,vScreen.y-10,Color(200,200,200,hp), hitpoints);
  43.             }
  44.         }
  45.     }
  46. }
Add Comment
Please, Sign In to add comment