-
Автор темы
- #1
C++:
// make sure we have a valid weapon.
const auto pWeapon = get_weapon(g_pLocalPlayer->get_active_weapon());
if (!pWeapon)
return;
const auto pWeaponData = pWeapon->get_wpn_data();
const int m_iRenderWidth = player.width * 2 - 2;
const float m_flShotCooldown = pWeaponData->flCycleTime;
const float m_flNextShotTime = pWeapon->get_next_primary_attack();
float m_flFraction = (m_flNextShotTime - g_pGameGlobals->m_flCurtime) / m_flShotCooldown;
m_flFraction = std::clamp<float>(m_flFraction, 0.f, 1.0f);
const float m_flWidth = m_iRenderWidth * (1.0f - m_flFraction);
// do your render however u do it, and do your Width as m_flWidth
Пожалуйста, авторизуйтесь для просмотра ссылки.
Последнее редактирование: