Исходник Enrage.gg doubletap to supremacy

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
310
Реакции[?]
194
Поинты[?]
100K
C++:
void C_ExploitSystem::Instance( )
{
    if ( !m_Data.m_Selected /*|| !g_PacketManager->GetModifablePacket( )*/ )
        return;

    auto pCombatWeapon = g_cl.m_weapon;
    if ( !pCombatWeapon || pCombatWeapon->m_iItemDefinitionIndex( ) == REVOLVER || !( g_cl.m_cmd->m_buttons & IN_ATTACK ) ) // GetModifableCommand = cmd
        return;

    if ( !pCombatWeapon->IsGun( ) || !g_cl.CanFireWeaponModifiable( game::TICKS_TO_TIME( g_cl.m_local->m_nTickBase( ) ))/*!g_Globals.m_AccuracyData.m_bCanFire_Default || !g_Globals.m_AccuracyData.m_bCanFire_Shift */ )
        return;

    if ( m_Data.m_ShiftTick )
    {
        m_Data.m_ShiftTick = game::TIME_TO_TICKS( g_csgo.m_globals->m_realtime + 0.7 );
        return;
    }

    if ( m_Data.m_Selected == EXPLOIT::DOUBLETAP )
    {
        m_Data.m_ShiftMode = MODE::SHIFT_MOVE;
        m_Data.m_ShiftAmount = m_Data.m_NextShift;

        return;
    }

    m_Data.m_ShiftMode = MODE::SHIFT_BUFFER;
    m_Data.m_ShiftAmount = m_Data.m_NextShift;
    m_Data.m_ShiftCommand = g_cl.m_cmd->m_command_number;
    m_Data.m_ShiftedTickbase = m_Data.m_ShiftAmount;
}

void C_ExploitSystem::BreakLagCompensation( )
{
    if ( ( m_Data.m_Selected != EXPLOIT::DOUBLETAP ) || m_Data.m_ShiftTick /* || !g_PacketManager->GetModifablePacket( )*/ )
        return;

    auto pCombatWeapon = g_cl.m_weapon;
    if ( !pCombatWeapon || pCombatWeapon->m_iItemDefinitionIndex( ) == REVOLVER || ( g_cl.CanFireWeaponModifiable( game::TICKS_TO_TIME( g_cl.m_local->m_nTickBase( ) ) ) && ( g_cl.m_cmd->m_buttons & IN_ATTACK ) ) )
        return;

    m_Data.m_ShiftMode = MODE::SHIFT_BUFFER;
    m_Data.m_ShiftAmount = 13;

    auto shift_amount = m_Data.m_ShiftAmount;
    m_Data.m_ShiftAmount = 0;

    // finish this
}

void C_ExploitSystem::SetupCommand( ) {
    auto m_LocalPlayer = g_cl.m_local;
    if ( !m_LocalPlayer || !m_LocalPlayer->alive( ) )
    {
        m_Data.m_Selected = 0;
        m_Data.m_TicksAllowedForProcessing = 0;

        return;
    }

    if ( ( m_LocalPlayer->m_fFlags( ) & FL_FROZEN ) || g_csgo.m_gamerules->m_bFreezePeriod() )
    {
        m_Data.m_Selected = 0;
        m_Data.m_TicksAllowedForProcessing = 0;

        return;
    }

    auto pCombatWeapon = g_cl.m_weapon;
    if ( !pCombatWeapon )
        return;

    bool dt2;
    auto dt = UTILS::KeybindMethod( settings.m_dt_key, settings.dtstyle, &dt2 );
    bool bIsDoubleTapActive = dt;
    int m_OldSelected = m_Data.m_Selected;
    m_Data.m_Selected = 0;
    if ( bIsDoubleTapActive )
        m_Data.m_Selected = EXPLOIT::DOUBLETAP;

    if ( !m_OldSelected && m_Data.m_Selected )
    {
        m_Data.m_ChargeCommand = g_cl.m_cmd->m_command_number;
        m_Data.m_ChargeAmount = 17 - m_Data.m_TicksAllowedForProcessing;
    }

    bool bResetting = false;
    if ( m_OldSelected == EXPLOIT::DOUBLETAP || m_OldSelected == EXPLOIT::HIDESHOTS )
    {
        if ( !m_Data.m_Selected )
        {
            m_Data.m_NextShift = m_Data.m_TicksAllowedForProcessing;
            m_Data.m_ShiftMode = MODE::SHIFT_MOVE;
            m_Data.m_ShiftAmount = m_Data.m_NextShift;
            m_Data.m_ShiftCommand = g_cl.m_cmd->m_command_number;
            m_Data.m_ShiftedTickbase = m_Data.m_ShiftAmount;
        }
    }

    int custom_shift{};
    if ( settings.dt_shift_custom )
        custom_shift = settings.shift_ticks_custom;
    else
        custom_shift = 13;

    m_Data.m_NextShift = 0;
    switch ( m_Data.m_Selected )
    {
        case EXPLOIT::DOUBLETAP: m_Data.m_NextShift = custom_shift; break;
        case EXPLOIT::HIDESHOTS: m_Data.m_NextShift = 9; break;
    }

    m_Data.m_ForceSend = false;

    if ( settings.dt_stop_option1 ) {
        if ( !pCombatWeapon->CanShift( ) )
            m_Data.m_NextShift = 0;
    } // disable unsafe

    if ( m_Data.m_Selected )
    {
        if ( m_Data.m_ShiftTick )
        {
            m_Data.m_NextShift = 0;
            if ( game::TIME_TO_TICKS( g_csgo.m_globals->m_realtime ) == m_Data.m_ShiftTick )
            {
                m_Data.m_ChargeCommand = g_cl.m_cmd->m_command_number;
                m_Data.m_ChargeAmount = 17 - m_Data.m_TicksAllowedForProcessing;
            }
        }
    }
}

bool C_ExploitSystem::IsFinalTick( )
{
    if ( !g_csgo.m_engine->IsInGame( ) || !g_csgo.m_engine->IsConnected( ) )
        return true;

    if ( !g_cl.m_local || !g_cl.m_local->alive( ) )
        return true;

    if ( !m_Data.m_Selected || !m_Data.m_ShiftAmount )
        return true;

    return false;
}

int32_t C_ExploitSystem::GetNetworkTickbase( int32_t nCommand )
{
    int32_t nTickbase = g_cl.m_local->m_nTickBase( );
    if ( m_Data.m_Selected == DOUBLETAP )
        return nTickbase;

    if ( nCommand == m_Data.m_ShiftCommand )
        return nTickbase - m_Data.m_ShiftedTickbase;
    else if ( nCommand == m_Data.m_ShiftCommand + 1 )
        return nTickbase + m_Data.m_ShiftedTickbase;

    return nTickbase;
}

bool C_ExploitSystem::PerformCommand( ) {
    m_Data.m_TicksToStop = 0;
    if ( m_Data.m_ShiftTick || !m_Data.m_ShiftingTickbase || m_Data.m_ShiftMode != MODE::SHIFT_MOVE )
        return true;

    auto pCombatWeapon = g_cl.m_weapon;
    if ( !pCombatWeapon )
        return false;

    auto pWeaponData = pCombatWeapon->GetWpnData( );
    if ( !pWeaponData )
        return false;

    int32_t iCurrentWeapon = -1;
    switch ( pCombatWeapon->m_iItemDefinitionIndex( ) )
    {
    case AK47:
    case M4A4:
    case M4A1S:
    case FAMAS:
    case SG553:
    case GALIL:
        iCurrentWeapon = WEAPONTYPE_RIFLE; break;
    case MAG7:
    case NOVA:
    case XM1014:
    case SAWEDOFF:
        iCurrentWeapon = WEAPONTYPE_SHOTGUN; break;
    case MP7:
    case MP9:
    case P90:
    case M249:
    case NEGEV:
    case UMP45:
        iCurrentWeapon = WEAPONTYPE_SUBMACHINEGUN; break;
    case SCAR20:
    case SSG08:
    case AWP:
    case G3SG1:
        iCurrentWeapon = WEAPONTYPE_SNIPER_RIFLE; break;
    case GLOCK:
    case P2000:
    case USPS:
    case CZ75A:
    case TEC9:
    case ELITE:
    case FIVESEVEN:
    case P250:
    case DEAGLE:
    case REVOLVER:
        iCurrentWeapon = WEAPONTYPE_PISTOL; break;
    default: iCurrentWeapon = -1;
    }

    if ( iCurrentWeapon < 0 )
        return false;

    float_t flMaxSpeed = GetMaxPlayerSpeed( );

    auto BoostMovement = [ & ]( )
    {
        /* get cmd move data */
        float& flForwardMove = g_cl.m_cmd->m_forward_move;
        float& flSideMove = g_cl.m_cmd->m_side_move;
        int& nButtons = g_cl.m_cmd->m_buttons;

        /* Force .y movement */
        if ( flForwardMove > 5.0f )
        {
            /* force buttons */
            nButtons |= IN_FORWARD;
            nButtons &= ~IN_BACK;

            /* force movement */
            flForwardMove = 450.0f;
        }
        else if ( flForwardMove < -5.0f )
        {
            /* force buttons */
            nButtons |= IN_BACK;
            nButtons &= ~IN_FORWARD;

            /* force movement */
            flForwardMove = -450.0f;
        }

        /* Force .x movement */
        if ( flSideMove > 5.0f )
        {
            /* force buttons */
            nButtons |= IN_MOVERIGHT;
            nButtons &= ~IN_MOVELEFT;

            /* force movement */
            flSideMove = 450.0f;
        }
        else if ( flSideMove < -5.0f )
        {
            /* force buttons */
            nButtons |= IN_MOVELEFT;
            nButtons &= ~IN_MOVERIGHT;

            /* force movement */
            flSideMove = -450.0f;
        }

        /* do not slowdown */
        nButtons &= ~IN_SPEED;
    };


    //g_cl.m_cmd->m_buttons &= ~( IN_ATTACK | IN_ATTACK2 );

    if ( m_Data.m_RemainToShift <= m_Data.m_TicksToStop ) {
        g_movement.QuickStop( );
    }

    if ( settings.dt_defensive_teleport ) {
        BoostMovement( );
    }

    // this should work
    *g_cl.m_packet = false;
    if ( m_Data.m_IsFinalTick )
        *g_cl.m_packet = true;

    if ( *g_cl.m_packet ) {
        nem::g_networking->push_command( g_cl.m_cmd->m_command_number );
    }
    else {
        { /* push command and finish network */
            int32_t iChokedCommand = g_csgo.m_cl->m_net_channel->m_choked_packets; // choked_commands?
            int32_t iSequenceNumber = g_csgo.m_cl->m_net_channel->m_out_seq;

            g_csgo.m_cl->m_net_channel->m_choked_packets = 0;
            g_csgo.m_cl->m_net_channel->SendDatagram( NULL );
             g_csgo.m_cl->m_net_channel->m_out_seq = iSequenceNumber;
             g_csgo.m_cl->m_net_channel->m_choked_packets = iChokedCommand;
        }
    }

    return false;
}

void C_ExploitSystem::PerformPackets( )
{
    if ( !m_Data.m_ShiftAmount || m_Data.m_ShiftMode != MODE::SHIFT_MOVE )
        return;


    // this is old
    for ( int32_t iShiftTime = 0; iShiftTime < m_Data.m_ShiftAmount; iShiftTime++ )
    {
        m_Data.m_RemainToShift = m_Data.m_ShiftAmount - iShiftTime;
        m_Data.m_IsFinalTick = m_Data.m_RemainToShift == 1;
        m_Data.m_ShiftingTickbase = true;

        o_CLMove( 0.0f, m_Data.m_IsFinalTick );
        //g_Globals.m_Hooks.m_Originals.m_CL_Move( 0.0f, m_Data.m_IsFinalTick );
    }

    m_Data.m_ShiftingTickbase = false;
    m_Data.m_TicksAllowedForProcessing = 0;
    m_Data.m_ShiftTick = game::TIME_TO_TICKS( g_csgo.m_globals->m_realtime + 0.7 );
    m_Data.m_ShiftAmount = 0;
    m_Data.m_NextShift = 0;
    m_Data.m_IsFinalTick = false;
}

void C_ExploitSystem::ShiftTickbase( int nAmount )
{
    m_Data.m_ShiftAmount = nAmount;
    m_Data.m_ShiftedTickbase = nAmount;
    m_Data.m_ShiftMode = MODE::SHIFT_BUFFER;
    m_Data.m_ShiftCommand = g_cl.m_cmd->m_command_number;
}

bool C_ExploitSystem::IsAllowedToRun( )
{
    if ( !g_csgo.m_engine->IsInGame( ) || !g_csgo.m_engine->IsConnected( ) )
        return true;

    if ( !g_cl.m_local || !g_cl.m_local->alive( ) || !m_Data.m_Selected )
        return true;
    
    if ( m_Data.m_ShiftTick )
    {
        if ( game::TIME_TO_TICKS( g_csgo.m_globals->m_realtime ) <= m_Data.m_ShiftTick )
            return true;
    }

    int custom_shift{};
    if (settings.dt_shift_custom)
        custom_shift = settings.shift_ticks_custom;
    else
        custom_shift = 13;

    m_Data.m_ShiftTick = 0;
    if ( m_Data.m_TicksAllowedForProcessing > custom_shift + 1 )
        return true;
    else
        g_csgo.m_globals->m_interp_amt = 0.0f;

    m_Data.m_TicksAllowedForProcessing++;
    return false;
}
 
Сверху Снизу