Facebook
From q, 2 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 43
  1. static bool lastvelsaved = false; //saver
  2.         static int lastjump, lastvel, lasttick = 0; // last vel holder
  3.         static std::string drawvel; //text drawer holder
  4.         static std::string drawvel2;
  5.         if (g_Options.misc_velo && g_EngineClient->IsConnected() && g_EngineClient->IsInGame() && g_LocalPlayer) {
  6.                 int screenWidth, screenHeight;
  7.                 g_EngineClient->GetScreenSize(screenWidth, screenHeight);
  8.  
  9.                 auto local_player = g_LocalPlayer;
  10.  
  11.                 Vector speed = local_player->m_vecVelocity();
  12.                 int intspeed = round(speed.Length2D());
  13.  
  14.                 const float delta = intspeed - lastvel;
  15.  
  16.                 std::string vel = std::to_string(intspeed);
  17.                 if (g_LocalPlayer->m_fFlags() & FL_ONGROUND)
  18.                 {
  19.                         if (lastvelsaved)
  20.                         {
  21.                                 lastvelsaved = false;
  22.                         }
  23.  
  24.                         drawvel = vel;
  25.                 }
  26.                 else
  27.                 {
  28.                         if (!lastvelsaved)
  29.                         {
  30.                                 lastjump = intspeed;
  31.                                 lastvelsaved = true;
  32.                         }
  33.                         if (g_Options.misc_pre)
  34.                                 drawvel = vel + " (" + std::to_string(lastjump) + ")";
  35.                         else
  36.                                 drawvel = vel;
  37.                 }
  38.                 drawvel2 = "(" + std::to_string(lastjump) + ")";
  39.  
  40.                 Color col = Color::Color(255, 255, 255);
  41.  
  42.                 if (delta < 0) {
  43.                         col = Color::Color(225, 100, 100);
  44.                 }
  45.                 else if (delta > 0) {
  46.                         col = Color::Color(255, 200, 100);
  47.                 }
  48.                 else if (delta == 0) {
  49.                         col = Color::Color(25, 255, 100);
  50.                 }
  51.  
  52.                 if (g_GlobalVars->tickcount < lasttick) {
  53.                         lasttick = g_GlobalVars->tickcount;
  54.                         lastvel = intspeed;
  55.                 }
  56.  
  57.                 if (g_GlobalVars->tickcount > lasttick + 16)
  58.                 {
  59.                         lasttick = g_GlobalVars->tickcount;
  60.                         lastvel = intspeed;
  61.                 }
  62.                 Color black = Color::FromHSB(0, 0, 0);
  63.                 Render::Get().RenderText(drawvel, screenWidth / 2 + 2, screenHeight - g_Options.misc_velooffset + 1, g_Options.misc_velosize, black, true, false, g_pSecondFont);
  64.                 Render::Get().RenderText(drawvel, screenWidth / 2, screenHeight - g_Options.misc_velooffset, g_Options.misc_velosize, col, true, false, g_pSecondFont);
  65.         }
  66.