Начинающий
-
Автор темы
- #1
my tickbase fix works just fine on client server but on a actual hvh server it does absolutely nothing.
where i use set_record.
the part that fails seems to be my valid check which basically checks if i used that before and it was not updated since.
Код:
inline std::array<tickbase_record, 150> record;struct tickbase_record {
int m_tickbase;
bool m_valid;
tickbase_record() {
m_tickbase = -1;
m_valid = false;
}
void store(int tickbase) {
m_tickbase = tickbase;
m_valid = true;
}
};
inline tickbase_record* get_record(int command) {
return &record[command % 150];
}
inline void set_record(int command, int tickbase) {
record[command % 150].store(tickbase);
}
Код:
void do_shift() {
if (m_need_charge)
return;
m_shift = m_charged_ticks;
m_need_charge = true;
m_can_shift = false;
engine_prediction::set_record(variables::m_cmd->command_number, utils::adjust_player_time_base(m_shift) + 1);
}
Код:
void __fastcall physics_simulate::hook(C_BasePlayer* player) {
int& sim_tick = *(int*)((uintptr_t)player + 0x2ACU);
CCommandContext* cmd_context = (CCommandContext*)((uintptr_t)player + 0x350C);
if (sim_tick == g_globals->tickcount)
return;
if (!cmd_context || !cmd_context->bNeedsProcessing)
return;
tickbase_record* record = engine_prediction::get_record(cmd_context->nCommandNumber);
if (record->m_valid) {
player->m_nTickBase() = record->m_tickbase - 1;
record->m_tickbase = -1;
record->m_valid = false;
}
return original(player);
}