-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
but code have some improves
C++:
bool lag_compensation::is_valid_tick( /*float time,*/ float sim_time, bool a2 ) {
if ( /*time == 0 || */sim_time == 0 /*|| !a2*/ )
return false;
// get net channel info state
i_net_channel_info* info = m_engine( )->get_net_channel_info( );
if ( !info )
return false;
// get server tick
// get_tick -> 208 index
int server_tick = m_engine( )->get_tick( ) + TIME_TO_TICKS( info->get_avg_latency( FLOW_OUTGOING ) );
// calc server_tick based on choked commands and determinate curr choked commands
if ( globals::m_fake_ducking )
server_tick = 14 - m_client_state( )->m_choked_commands;
// get correct based on out latency + in latency + lerp time and clamp on sv_maxunlag
float correct = 0;
// add out latency
correct += info->get_avg_latency( FLOW_OUTGOING );
// add in latency
correct += info->get_avg_latency( FLOW_INCOMING );
// add interpolation amount
correct += get_lerp_time( );
// clamp this shit
correct = clamp( correct, 0, sv_maxunlag->get_float( ) );
// calc tickbase
int shift = 0;
if ( globals::m_fake_ducking || !globals::m_exploits_allowed || globals::m_double_tap_key.not_pressed( ) || globals::m_hide_shots.not_pressed( ) )
shift = 0;
else {
if ( globals::m_exploits_allowed && globals::m_double_tap_key.has_pressed( ) || globals::m_hide_shots.has_pressed( ) && !globals::m_fake_ducking ) {
// determinate shift amount
shift = max( globals::m_shift_amount, globals::m_next_shift_amount );
// ohh thanks reisss for this premium codeeee
if ( globals::m_double_tap_key.has_pressed( ) || globals::m_hide_shots.has_pressed( ) && ( globals::m_ticks_allowed > 0 && globals::m_ticks_allowed < 15 ) )
shift = 14;
}
}
// def cur time
float time = m_globals( )->m_cur_time;
// get time based on shift amount
time = globals::m_local->is_alive( ) ? TICKS_TO_TIME( shift ) : m_globals( )->m_cur_time;
// get delta time
float delta_time = fabsf( correct - ( time - sim_time ) );
// if out of range
if ( delta_time > 0.2 )
return false;
// just ignore dead time or not?
return ( a2 ) || ( TICKS_TO_TIME( server_tick ) - sv_maxunlag->get_float( ) );
}