-
Автор темы
- #1
C++:
void worldesp::bomb_timer(entity_t* entity)
{
if (!config_system.g_cfg.esp.bright)
return;
if (!g_ctx.globals.bomb_timer_enable)
return;
static auto mp_c4timer = m_cvar()->FindVar(crypt_str("mp_c4timer"));
auto bomb = (CCSBomb*)entity;
auto c4timer = mp_c4timer->GetFloat();
auto bomb_timer = bomb->m_flC4Blow() - m_globals()->m_curtime;
if (bomb_timer < 0.0f)
return;
static int width, height;
m_engine()->GetScreenSize(width, height);
auto factor = bomb_timer / c4timer * height;
auto red_factor = (int)(255.0f - bomb_timer / c4timer * 255.0f);
auto green_factor = (int)(bomb_timer / c4timer * 255.0f);
auto distance = g_ctx.local()->get_shoot_position().DistTo(entity->GetAbsOrigin());
auto a = 450.7f;
auto b = 75.68f;
auto c = 789.2f;
auto d = ((distance - b) / c);
auto fl_damage = a * exp(-d * d);
//g_Render->FilledRect(0, height - factor, 26, factor, Color(0, 0, 0, 100));
float damage;
damage = float((std::max)((int)ceilf(util::csgo_armor(fl_damage, g_ctx.local()->m_ArmorValue())), 0));
//convert damage to string
std::string damage_text;
damage_text += "-";
damage_text += std::to_string((int)(damage));
damage_text += "HP";
if (g_ctx.local()->is_alive() && damage >= g_ctx.local()->m_iHealth())
damage_text = "FATAL";
g_Render->FilledRect(0, height - factor, 18, factor, Color(red_factor, green_factor, 0, 255));
g_Render->DrawString(19, height - factor, Color(255, 255, 255, 255), render2::none, c_menu::get().futura_small, damage_text.c_str());
auto text_position = height - factor + 11;
if (text_position > height - 9)
text_position = height - 9;
Vector screen;
factor = bomb_timer / c4timer;
auto c4_defuse_time = bomb->m_flDefuseCountDown() - (m_globals()->m_intervalpertick * g_ctx.local()->m_nTickBase());
auto defuse_value = c4_defuse_time / 6;
if (math::WorldToScreen(entity->GetAbsOrigin(), screen))
{
if (bomb->m_hBombDefuser() > 0)
{
if (c4timer > c4_defuse_time)
{
g_Render->CircleFilled(screen.x, screen.y - 50, 30, Color(20, 20, 20, 175), 30);
g_Render->DrawString(screen.x, screen.y - 75, Color(25, 80, 153, 200), render2::centered_x, c_menu::get().ico_menu, "r");
g_Render->DrawString2(screen.x - 7, screen.y - 55, Color(232, 232, 232, 200), render2::none, c_menu::get().futura_small, std::to_string((int)(round(c4_defuse_time))) + " s");
arc(screen.x, screen.y - 50, 30, 32, -90, 360 * defuse_value, Color(25, 80, 153, 200));
}
else
{
g_Render->CircleFilled(screen.x, screen.y - 50, 30, Color(20, 20, 20, 175), 30);
g_Render->DrawString(screen.x, screen.y - 75, Color(25, 80, 153, 200), render2::centered_x, c_menu::get().ico_menu, "r");
g_Render->DrawString2(screen.x - 7, screen.y - 55, Color(232, 232, 232, 200), render2::none, c_menu::get().futura_small, "NO TIME");
arc(screen.x, screen.y - 50, 30, 32, -90, 360 * defuse_value, Color(25, 80, 153, 200));
}
}
else
{
g_Render->CircleFilled(screen.x, screen.y - 50, 30, Color(20, 20, 20, 175), 30);
g_Render->DrawString(screen.x, screen.y - 75, Color(255, 70, 70, 200), render2::centered_x, c_menu::get().ico_menu, "o");
g_Render->DrawString2(screen.x - 7, screen.y - 55, Color(232, 232, 232, 200), render2::none, c_menu::get().futura_small, std::to_string((int)(round(bomb_timer))) + " s");
arc(screen.x, screen.y - 50, 30, 32, -90, 360 * factor, Color(232, 232, 232, 200));
}
}
}
struct trace_pos_info
{
Vector position;
float time = -1;
};
ps use render
Вложения
-
3.9 KB Просмотры: 136