Начинающий
- Статус
- Оффлайн
- Регистрация
- 13 Окт 2022
- Сообщения
- 30
- Реакции
- 0
C++:
void c_rage_bot::double_tap(c_user_cmd* cmd, c_base_player_weapon* weapon) {
if (!cmd || !weapon)
return;
double offset_tick = 0.0;
float next_primary_attack = weapon->m_next_primary_attack();
static int shot_count{};
static int old_shot_count{ };
double integral;
double fractional = modf(next_primary_attack, &integral);
double wat_offset_fractional = modf(weapon->m_next_primary_attack(), &offset_tick);
double temp = fractional + wat_offset_fractional;
int shoot_tick = static_cast<int>(integral) + static_cast<int>(offset_tick);
if (temp >= 0.0) {
if (temp >= 1.0)
++shoot_tick;
}
else {
--shoot_tick;
}
bool is_even_shot = shot_count % 2;
if (cmd->pb.attack1_start_history_index() > -1)
shot_count++;
for (int i = 0; i < cmd->pb.input_history_size(); ++i) {
auto* input_entry = cmd->get_input_entry(i);
if (!input_entry)
continue;
input_entry->set_player_tick_count(is_even_shot ? shoot_tick - 1 : 0);
input_entry->set_player_tick_fraction(0.0f);
}
cmd->pb.set_attack1_start_history_index(-1);
old_shot_count = shot_count;
std::cout << (old_shot_count) << std::endl;
std::cout << (shot_count) << std::endl;
}