-
Автор темы
- #1
C++:
bool CTickbase::CanProcessPacket( CUserCmd* m_pCmd ) {
bool dt2;
auto dt = UTILS::KeybindMethod( settings.m_dt_key, settings.dtstyle, &dt2 );
m_nChokeLimit = 14;
m_nShift = 0;
m_iMaxProcessTicks++;
m_bEnabled=dt;
auto m_pWeapon = g_cl.m_weapon;// g_LocalPlayer->m_hActiveWeapon( ).Get( );
if ( !m_bEnabled || !m_pWeapon || !m_pWeapon->IsGun( ) || m_pWeapon->m_iItemDefinitionIndex( ) == 64 )
{
if ( !dt )
m_bSwap = false;
return true;
}
if ( m_bSwap )
{
if ( m_iMaxProcessTicks >= 12 || g_csgo.m_cl->m_choked_commands >= 5 )
{
m_nChokeLimit = 1;
m_nShift = 9;
if(dt)
{
if ( CanShift( 12 ) || ( !CanShift( ) && m_bNextShift ) )
m_nShift = 12;
else if ( CanShift( ) )
m_nShift = 0;
}
else
m_bNextShift = false;
return true;
}
else
{
m_nShift = 0;
m_bEnabled=false;
return false;
}
}
else
{
m_iMaxProcessTicks = 0;
m_nShift = 0;
m_bEnabled=false;
m_pCmd->m_tick = INT_MAX;
m_bSwap = true;
return true;
}
}
bool CTickbase::CanShift( int m_nShiftedTicks )
{
if ( m_bProcessPacket )
return false;
auto m_pWeapon = g_cl.m_weapon;// g_LocalPlayer->m_hActiveWeapon( ).Get( );
if ( !m_pWeapon )
return false;
if ( g_cl.m_local->m_fFlags( ) & FL_ATCONTROLS )
return false;
if ( !m_pWeapon->m_iClip1( ) )
return false;
if ( !m_pWeapon->IsGun( ) || m_pWeapon->m_iItemDefinitionIndex( ) == 64 )
return false;
int m_nTickbase = 0;
if ( m_bEnabled && m_nShift > 0 )
m_nTickbase = g_cl.m_local->m_nTickBase( ) - m_nShift + 1;
if ( m_nShiftedTicks > 0 )
m_nTickbase = g_cl.m_local->m_nTickBase( ) - m_nShiftedTicks;
float m_flPlayerTime = m_nTickbase * g_csgo.m_globals->m_interval;
if ( m_flPlayerTime < std::min( g_cl.m_local->m_flNextAttack( ), m_pWeapon->m_flNextPrimaryAttack( ) ) )
return false;
return true;
}
void CTickbase::DoubleTap( CUserCmd* m_pCmd )
{
auto m_pWeapon = g_cl.m_weapon;// g_LocalPlayer->m_hActiveWeapon( ).Get( );
if ( !m_pWeapon )
return;
if ( !( m_pCmd->m_buttons & IN_ATTACK ) || !CanShift( ) || m_nShift <= 0 || !m_bEnabled )
return;
if ( g_csgo.m_cl->m_choked_commands < std::min( m_nChokeLimit, 14 ) )
*g_cl.m_packet = false;
m_ShotData.m_nCmd = m_pCmd->m_command_number;
m_ShotData.m_nShift = m_nShift;
m_ShotData.m_nTickbase = g_cl.m_local->m_nTickBase( );
}
void CTickbase::ShiftTickbase( CUserCmd* m_pCmd )
{
m_bProcessPacket = ( m_pCmd->m_buttons & IN_ATTACK ) && CanShift( );
return;
g_nTickbase = 0;
if ( !m_bEnabled )
return;
if ( m_bProcessPacket || ( ( m_pCmd->m_buttons & IN_ATTACK ) && CanShift( ) ) )
{
g_nTickbase = -m_nShift;
if ( m_nShift == 12 )
m_bNextShift = false;
else if ( !m_nShift )
m_bNextShift = true;
}
m_bProcessPacket = false;
m_bSwap = false;
}
void CTickbase::ResetData( )
{
g_nTickbase = 0;
m_iMaxProcessTicks = 0;
m_bSwap = false;
}
C++:
bool __fastcall write_user_cmd_delta_to_buffer( const std::uintptr_t ecx, const std::uintptr_t edx, const int slot, bf_write* const buffer, int from, int to, const bool is_new_cmd ) {
/// if ( g_tickbase.m_shift_data.m_ticks_to_shift <= 0 )
// return nem_hooks::orig_write_user_cmd_delta_to_buffer(ecx, edx, slot, buffer, from, to, is_new_cmd);//g_hooks.m_client.GetOldMethod<WriteUsercmdDeltaToBuffer_t>( 24 )( this, m_nSlot, m_pBuffer, m_nFrom, m_nTo, m_bNewCmd );
//return 0;
int m_nTickbase = g_ViolanesPaster.g_nTickbase;
if ( m_nTickbase >= 0 )
return nem_hooks::orig_write_user_cmd_delta_to_buffer( ecx, edx, slot, buffer, from, to, is_new_cmd );
auto m_nFrom = from;
auto m_pBuffer = buffer;
auto m_nSlot = slot;
auto m_nTo = to;
if ( m_nFrom != -1 )
return true;
g_ViolanesPaster.g_nTickbase = 0;
m_nFrom = -1;
*( int* )( ( uintptr_t )m_pBuffer - 0x30 ) = 0;
int* m_pnNewCmds = ( int* )( ( uintptr_t )m_pBuffer - 0x2C );
int m_nNewCmds = *m_pnNewCmds;
int m_nNextCmd = g_csgo.m_cl->m_choked_commands + g_csgo.m_cl->m_last_outgoing_command + 1;
int m_nTotalNewCmds = std::min( m_nNewCmds + abs( m_nTickbase ), 62 );
*m_pnNewCmds = m_nTotalNewCmds;
for ( m_nTo = m_nNextCmd - m_nNewCmds + 1; m_nTo <= m_nNextCmd; m_nTo++ )
{
if ( !nem_hooks::orig_write_user_cmd_delta_to_buffer( ecx, edx, m_nSlot, m_pBuffer, m_nFrom, m_nTo, true ) )
return false;
m_nFrom = m_nTo;
}
CUserCmd* m_pCmd = g_csgo.m_input->user_cmd( m_nSlot, m_nFrom );
if ( !m_pCmd )
return true;
CUserCmd m_FromCmd = *m_pCmd, m_ToCmd = *m_pCmd;
m_ToCmd.m_tick += 200;
m_ToCmd.m_command_number++;
for ( int i = m_nNewCmds; i <= m_nTotalNewCmds; i++ )
{
write_user_cmd( m_pBuffer, &m_ToCmd, &m_FromCmd );
m_FromCmd = m_ToCmd;
m_ToCmd.m_command_number++;
m_ToCmd.m_tick++;
}
return true;
}