static bool lastvelsaved = false; //saver static int lastjump, lastvel, lasttick = 0; // last vel holder static std::string drawvel; //text drawer holder static std::string drawvel2; if (g_Options.misc_velo && g_EngineClient->IsConnected() && g_EngineClient->IsInGame() && g_LocalPlayer) { int screenWidth, screenHeight; g_EngineClient->GetScreenSize(screenWidth, screenHeight); auto local_player = g_LocalPlayer; Vector speed = local_player->m_vecVelocity(); int intspeed = round(speed.Length2D()); const float delta = intspeed - lastvel; std::string vel = std::to_string(intspeed); if (g_LocalPlayer->m_fFlags() & FL_ONGROUND) { if (lastvelsaved) { lastvelsaved = false; } drawvel = vel; } else { if (!lastvelsaved) { lastjump = intspeed; lastvelsaved = true; } if (g_Options.misc_pre) drawvel = vel + " (" + std::to_string(lastjump) + ")"; else drawvel = vel; } drawvel2 = "(" + std::to_string(lastjump) + ")"; Color col = Color::Color(255, 255, 255); if (delta < 0) { col = Color::Color(225, 100, 100); } else if (delta > 0) { col = Color::Color(255, 200, 100); } else if (delta == 0) { col = Color::Color(25, 255, 100); } if (g_GlobalVars->tickcount < lasttick) { lasttick = g_GlobalVars->tickcount; lastvel = intspeed; } if (g_GlobalVars->tickcount > lasttick + 16) { lasttick = g_GlobalVars->tickcount; lastvel = intspeed; } Color black = Color::FromHSB(0, 0, 0); Render::Get().RenderText(drawvel, screenWidth / 2 + 2, screenHeight - g_Options.misc_velooffset + 1, g_Options.misc_velosize, black, true, false, g_pSecondFont); Render::Get().RenderText(drawvel, screenWidth / 2, screenHeight - g_Options.misc_velooffset, g_Options.misc_velosize, col, true, false, g_pSecondFont); }