Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.42 KB | None | 0 0
  1. void Visuals::Misc::RenderPlantedC4(C_BasePlayer* entity)
  2. {
  3.     Vector vOrig; Vector vScreen;
  4.     vOrig = entity->m_vecOrigin();
  5.     CCSBomb* Bomb = (CCSBomb*)entity;
  6.     if (!Bomb) return;
  7.     float flBlow = Bomb->GetC4BlowTime();
  8.     float lifetime = flBlow - (gpHC_GlobalVars->interval_per_tick * gpHC_LocalPlayer->m_nTickBase());
  9.     float countdown = Bomb->GetC4DefuseCountDown() - (gpHC_LocalPlayer->m_nTickBase() * gpHC_GlobalVars->interval_per_tick);
  10.  
  11.     if (Bomb->IsBombDefused()) return;
  12.  
  13.     float flDistance = gpHC_LocalPlayer->GetEyePos().DistTo(entity->GetEyePos());
  14.     float a = 450.7f;
  15.     float b = 75.68f;
  16.     float c = 789.2f;
  17.     float d = ((flDistance - b) / c);
  18.     float flDamage = a * exp(-d * d) - 1;
  19.  
  20.     float damage = float((std::max)((int)ceilf(CSGO_Armor(flDamage, gpHC_LocalPlayer->m_ArmorValue())), 0));
  21.  
  22.     char buffer[32];
  23.     char buffer2[32];
  24.     char buffer3[32];
  25.     sprintf(buffer, "Bomb: %.2f", lifetime);
  26.     sprintf(buffer2, "Damage: %.0f", damage);
  27.     sprintf(buffer3, "Defuse: %.2f", countdown);
  28.  
  29.     if (Math::WorldToScreen(vOrig, vScreen))
  30.     {
  31.         if (damage >= gpHC_LocalPlayer->m_iHealth())
  32.         {
  33.             Visuals::DrawString(defuse_font, vScreen.x, vScreen.y, Color(240, 30, 30), 2, buffer2);
  34.         }
  35.         else
  36.         {
  37.             Visuals::DrawString(defuse_font, vScreen.x, vScreen.y, Color(30, 240, 30), 2, buffer2);
  38.         }
  39.  
  40.         if (Bomb->GetBombDefuser() > 0)
  41.         {
  42.             if (countdown > 0.01f)
  43.             {
  44.                 if (lifetime > countdown)
  45.                 {
  46.                     Visuals::DrawString(defuse_font, vScreen.x, vScreen.y + 22, Color(30, 240, 30), 2, buffer3);
  47.                 }
  48.                 else
  49.                 {
  50.                     Visuals::DrawString(defuse_font, vScreen.x, vScreen.y + 22, Color(240, 30, 30), 2, buffer3);
  51.                 }
  52.             }
  53.         }
  54.  
  55.         Visuals::DrawString(defuse_font, vScreen.x, vScreen.y + 12, g_Options.color_esp_c4, 2, buffer);
  56.     }
  57.  
  58.  
  59.     int x, y;
  60.     gpHC_EngineClient->GetScreenSize(x, y);
  61.  
  62.     if (damage >= gpHC_LocalPlayer->m_iHealth())
  63.     {
  64.         Visuals::DrawString(defuse_font, 40, y / 2 + 12, Color(240, 30, 30), 2, buffer2);
  65.     }
  66.     else
  67.     {
  68.         Visuals::DrawString(defuse_font, 40, y / 2 + 12, Color(30, 240, 30), 2, buffer2);
  69.     }
  70.  
  71.     if (Bomb->GetBombDefuser() > 0)
  72.     {
  73.         if (countdown > 0.01f)
  74.         {
  75.             if (lifetime > countdown)
  76.             {
  77.                 Visuals::DrawString(defuse_font, 40, y / 2 + 22, Color(30, 240, 30), 2, buffer3);
  78.             }
  79.             else
  80.             {
  81.                 Visuals::DrawString(defuse_font, 40, y / 2 + 22, Color(240, 30, 30), 2, buffer3);
  82.             }
  83.         }
  84.     }
  85.     Visuals::DrawString(defuse_font, 40, y / 2, g_Options.color_esp_c4, 2, buffer);
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement