Welcome to hackvshack.net Forum!
Download Free HvH CS2/CS:GO Cheats, CFG, LUA/JS Scripts, and More!
Register

C++ How to force the first DT bullet to use the current crosshair/target?

kunshu666

Newbie HvHer
User ID:
245374
Messages:
15
Reactions:
3
Badges:
2
REP:
−0/0+
Level:
18
After triggering Double Tap, the trajectory of the first bullet always inherits the direction of the last shot fired, instead of using my current view angles.

Code:
  1. void ragebot::double_tap()
  2. {
  3. if (!settings.cfg().ragebot.b_ragebot || !settings.cfg().ragebot.m_doubletap || !sdk::m_cmd || !sdk::m_local_pawn || !sdk::m_local_pawn->ActiveWeapon()) return;
  4. static int shot_count{};
  5. static int old_shot_count{ };
  6. double offset_tick{ };
  7. auto temp = sdk::m_local_pawn->ActiveWeapon()->m_next_primary_attack_tick_ratio() + modf(sdk::m_local_pawn->ActiveWeapon()->m_iWatTickOffset(), &offset_tick);
  8. auto next_attack = sdk::m_local_pawn->ActiveWeapon()->m_next_primary_attack_tick();
  9. auto shoot_tick = (int)next_attack + offset_tick;
  10. if (temp >= 0.0) {
  11. if (temp >= 1.0) {
  12. ++shoot_tick;
  13. }
  14. }
  15. else {
  16. --shoot_tick;
  17. }
  18. bool f = shot_count % 2;
  19. if (sdk::m_cmd->pb.attack1_start_history_index() > -1)
  20. shot_count++;
  21. for (int i = 0; i < sdk::m_cmd->pb.input_history_size(); i++) {
  22. auto input_history = sdk::m_cmd->pb.mutable_input_history(i);
  23. if (!input_history) {
  24. continue;
  25. }
  26. input_history->set_player_tick_count(f ? shoot_tick - 1 : 0);
  27. input_history->set_player_tick_fraction(0.f);
  28. }
  29. sdk::m_cmd->pb.set_attack1_start_history_index(-1);
  30. old_shot_count = shot_count;
  31. }
 
idk if this works but:
void ragebot::double_tap()
{
if (!settings.cfg().ragebot.b_ragebot || !settings.cfg().ragebot.m_doubletap || !sdk::m_cmd || !sdk::m_local_pawn || !sdk::m_local_pawn->ActiveWeapon()) return;

static int shot_count{};
static int old_shot_count{};
double offset_tick{};

auto weapon = sdk::m_local_pawn->ActiveWeapon();
auto temp = weapon->m_next_primary_attack_tick_ratio() + modf(weapon->m_iWatTickOffset(), &offset_tick);
auto next_attack = weapon->m_next_primary_attack_tick();
auto shoot_tick = (int)next_attack + offset_tick;

if (temp >= 0.0) {
if (temp >= 1.0) {
++shoot_tick;
}
}
else {
--shoot_tick;
}

bool f = shot_count % 2;
if (sdk::m_cmd->pb.attack1_start_history_index() > -1)
shot_count++;

// grab your current command view angles (or override with your ragebot target angles if calculated prior)
auto current_angles = sdk::m_cmd->pb.view_angles();

for (int i = 0; i < sdk::m_cmd->pb.input_history_size(); i++) {
auto input_history = sdk::m_cmd->pb.mutable_input_history(i);
if (!input_history) {
continue;
}

// set your shifted tick count
input_history->set_player_tick_count(f ? shoot_tick - 1 : 0);
input_history->set_player_tick_fraction(0.f);

// force the input history entry to use current view angles so it doesnt hold old directions
if (input_history->has_view_angles()) {
input_history->mutable_view_angles()->CopyFrom(current_angles);
}
}

sdk::m_cmd->pb.set_attack1_start_history_index(-1);
old_shot_count = shot_count;
}
 
After triggering Double Tap, the trajectory of the first bullet always inherits the direction of the last shot fired, instead of using my current view angles.

Code:
  1. void ragebot::double_tap()
  2. {
  3. if (!settings.cfg().ragebot.b_ragebot || !settings.cfg().ragebot.m_doubletap || !sdk::m_cmd || !sdk::m_local_pawn || !sdk::m_local_pawn->ActiveWeapon()) return;
  4. static int shot_count{};
  5. static int old_shot_count{ };
  6. double offset_tick{ };
  7. auto temp = sdk::m_local_pawn->ActiveWeapon()->m_next_primary_attack_tick_ratio() + modf(sdk::m_local_pawn->ActiveWeapon()->m_iWatTickOffset(), &offset_tick);
  8. auto next_attack = sdk::m_local_pawn->ActiveWeapon()->m_next_primary_attack_tick();
  9. auto shoot_tick = (int)next_attack + offset_tick;
  10. if (temp >= 0.0) {
  11. if (temp >= 1.0) {
  12. ++shoot_tick;
  13. }
  14. }
  15. else {
  16. --shoot_tick;
  17. }
  18. bool f = shot_count % 2;


  19. if (sdk::m_cmd->pb.attack1_start_history_index() > -1)
  20. shot_count++;
  21. for (int i = 0; i < sdk::m_cmd->pb.input_history_size(); i++) {
  22. auto input_history = sdk::m_cmd->pb.mutable_input_history(i);
  23. if (!input_history) {
  24. continue;
  25. }
  26. input_history->set_player_tick_count(f ? shoot_tick - 1 : 0);
  27. input_history->set_player_tick_fraction(0.f);
  28. }
  29. sdk::m_cmd->pb.set_attack1_start_history_index(-1);
  30. old_shot_count = shot_count;
  31. }
nice now double tap tutorial
 
  • Like
Reactions: halapa
idk if this works but:
void ragebot::double_tap()
{
if (!settings.cfg().ragebot.b_ragebot || !settings.cfg().ragebot.m_doubletap || !sdk::m_cmd || !sdk::m_local_pawn || !sdk::m_local_pawn->ActiveWeapon()) return;

static int shot_count{};
static int old_shot_count{};
double offset_tick{};

auto weapon = sdk::m_local_pawn->ActiveWeapon();
auto temp = weapon->m_next_primary_attack_tick_ratio() + modf(weapon->m_iWatTickOffset(), &offset_tick);
auto next_attack = weapon->m_next_primary_attack_tick();
auto shoot_tick = (int)next_attack + offset_tick;

if (temp >= 0.0) {
if (temp >= 1.0) {
++shoot_tick;
}
}
else {
--shoot_tick;
}

bool f = shot_count % 2;
if (sdk::m_cmd->pb.attack1_start_history_index() > -1)
shot_count++;

// grab your current command view angles (or override with your ragebot target angles if calculated prior)
auto current_angles = sdk::m_cmd->pb.view_angles();

for (int i = 0; i < sdk::m_cmd->pb.input_history_size(); i++) {
auto input_history = sdk::m_cmd->pb.mutable_input_history(i);
if (!input_history) {
continue;
}

// set your shifted tick count
input_history->set_player_tick_count(f ? shoot_tick - 1 : 0);
input_history->set_player_tick_fraction(0.f);

// force the input history entry to use current view angles so it doesnt hold old directions
if (input_history->has_view_angles()) {
input_history->mutable_view_angles()->CopyFrom(current_angles);
}
}

sdk::m_cmd->pb.set_attack1_start_history_index(-1);
old_shot_count = shot_count;
}
W pedro
 
idk if this works but:
void ragebot::double_tap()
{
if (!settings.cfg().ragebot.b_ragebot || !settings.cfg().ragebot.m_doubletap || !sdk::m_cmd || !sdk::m_local_pawn || !sdk::m_local_pawn->ActiveWeapon()) return;

static int shot_count{};
static int old_shot_count{};
double offset_tick{};

auto weapon = sdk::m_local_pawn->ActiveWeapon();
auto temp = weapon->m_next_primary_attack_tick_ratio() + modf(weapon->m_iWatTickOffset(), &offset_tick);
auto next_attack = weapon->m_next_primary_attack_tick();
auto shoot_tick = (int)next_attack + offset_tick;

if (temp >= 0.0) {
if (temp >= 1.0) {
++shoot_tick;
}
}
else {
--shoot_tick;
}

bool f = shot_count % 2;
if (sdk::m_cmd->pb.attack1_start_history_index() > -1)
shot_count++;

// grab your current command view angles (or override with your ragebot target angles if calculated prior)
auto current_angles = sdk::m_cmd->pb.view_angles();

for (int i = 0; i < sdk::m_cmd->pb.input_history_size(); i++) {
auto input_history = sdk::m_cmd->pb.mutable_input_history(i);
if (!input_history) {
continue;
}

// set your shifted tick count
input_history->set_player_tick_count(f ? shoot_tick - 1 : 0);
input_history->set_player_tick_fraction(0.f);

// force the input history entry to use current view angles so it doesnt hold old directions
if (input_history->has_view_angles()) {
input_history->mutable_view_angles()->CopyFrom(current_angles);
}
}

sdk::m_cmd->pb.set_attack1_start_history_index(-1);
old_shot_count = shot_count;
}
THIS is doesn't work, so Is there any other way? pls
 
idk if this works but:
void ragebot::double_tap()
{
if (!settings.cfg().ragebot.b_ragebot || !settings.cfg().ragebot.m_doubletap || !sdk::m_cmd || !sdk::m_local_pawn || !sdk::m_local_pawn->ActiveWeapon()) return;

static int shot_count{};
static int old_shot_count{};
double offset_tick{};

auto weapon = sdk::m_local_pawn->ActiveWeapon();
auto temp = weapon->m_next_primary_attack_tick_ratio() + modf(weapon->m_iWatTickOffset(), &offset_tick);
auto next_attack = weapon->m_next_primary_attack_tick();
auto shoot_tick = (int)next_attack + offset_tick;

if (temp >= 0.0) {
if (temp >= 1.0) {
++shoot_tick;
}
}
else {
--shoot_tick;
}

bool f = shot_count % 2;
if (sdk::m_cmd->pb.attack1_start_history_index() > -1)
shot_count++;

// grab your current command view angles (or override with your ragebot target angles if calculated prior)
auto current_angles = sdk::m_cmd->pb.view_angles();

for (int i = 0; i < sdk::m_cmd->pb.input_history_size(); i++) {
auto input_history = sdk::m_cmd->pb.mutable_input_history(i);
if (!input_history) {
continue;
}

// set your shifted tick count
input_history->set_player_tick_count(f ? shoot_tick - 1 : 0);
input_history->set_player_tick_fraction(0.f);

// force the input history entry to use current view angles so it doesnt hold old directions
if (input_history->has_view_angles()) {
input_history->mutable_view_angles()->CopyFrom(current_angles);
}
}

sdk::m_cmd->pb.set_attack1_start_history_index(-1);
old_shot_count = shot_count;
}
set_attack1_start_history_index(-1),Under this code, the server will only use the perspective it has stored instead of the aiming one, you can try using it.Unless you rely on the sv_late_commands_allowed console command like neverlose to do the positioning, but I won't.
 
THIS is doesn't work, so Is there any other way? pls
idk but maybe work (i found other forum)

double tap:
Expand Collapse Copy
    void rage::process_doubletap( systems::input::usercmd* cmd, const systems::local::snapshot& local, bool charge_dt )
    {
        const auto& shared_ctx = g_shared.ctx( );
        const auto& config = settings::g_combat.m_ragebot.get_group( shared_ctx.weapon_type );
        if ( !config.doubletap.value )
        {
            return;
        }

        const auto base_cmd = cmd->csgo_user_cmd.mutable_base( );
        if ( !base_cmd )
        {
            return;
        }

        const auto client_tick = base_cmd->client_tick( );
        const auto next_primary = memory::read<int>( shared_ctx.weapon + SCHEMA( "C_BasePlayerWeapon", "m_nNextPrimaryAttackTick"_hash ) );
        const auto tick_base = memory::read<int>( local.controller + SCHEMA( "CBasePlayerController", "m_nTickBase"_hash ) );

        const auto can_attack = client_tick >= next_primary && tick_base >= g_shared.last_shoot_tick( ) + 2 && !memory::read<bool>( shared_ctx.weapon + SCHEMA( "C_CSWeaponBase", "m_bInReload"_hash ) ) && memory::read<int>( shared_ctx.weapon + SCHEMA( "C_BasePlayerWeapon", "m_iClip1"_hash ) ) > 0;

        const auto should_attack = can_attack && charge_dt;

        const auto history_n = cmd->csgo_user_cmd.input_history_size( );
        for ( auto i = 0; i < history_n; ++i )
        {
            if ( const auto entry = cmd->csgo_user_cmd.mutable_input_history( i ) )
            {
                entry->set_player_tick_count( should_attack ? next_primary : 0 );
            }
        }

        if ( should_attack && !this->m_doubletap_fired )
        {
            if ( const auto subtick_moves = base_cmd->mutable_subtick_moves( ) )
            {
                if ( const auto press = systems::g_input.acquire_subtick_step( subtick_moves ) )
                {
                    press->set_button( cstypes::command_buttons::in_attack );
                    press->set_pressed( true );
                    press->set_when( 0.0f );
                    press->set_analog_forward_delta( 0.0f );
                    press->set_analog_left_delta( 0.0f );
                }

                if ( const auto release = systems::g_input.acquire_subtick_step( subtick_moves ) )
                {
                    release->set_button( cstypes::command_buttons::in_attack );
                    release->set_pressed( false );
                    release->set_when( 1.0f );
                    release->set_analog_forward_delta( 0.0f );
                    release->set_analog_left_delta( 0.0f );
                }
            }
        }
        else
        {
            cmd->buttons.value &= ~cstypes::command_buttons::in_attack;
            cmd->buttons.value_changed |= cstypes::command_buttons::in_attack;
        }

        this->m_doubletap_fired = should_attack && !this->m_doubletap_fired;

        cmd->csgo_user_cmd.set_attack1_start_history_index( -1 );
    }
 
idk but maybe work (i found other forum)

double tap:
Expand Collapse Copy
    void rage::process_doubletap( systems::input::usercmd* cmd, const systems::local::snapshot& local, bool charge_dt )
    {
        const auto& shared_ctx = g_shared.ctx( );
        const auto& config = settings::g_combat.m_ragebot.get_group( shared_ctx.weapon_type );
        if ( !config.doubletap.value )
        {
            return;
        }

        const auto base_cmd = cmd->csgo_user_cmd.mutable_base( );
        if ( !base_cmd )
        {
            return;
        }

        const auto client_tick = base_cmd->client_tick( );
        const auto next_primary = memory::read<int>( shared_ctx.weapon + SCHEMA( "C_BasePlayerWeapon", "m_nNextPrimaryAttackTick"_hash ) );
        const auto tick_base = memory::read<int>( local.controller + SCHEMA( "CBasePlayerController", "m_nTickBase"_hash ) );

        const auto can_attack = client_tick >= next_primary && tick_base >= g_shared.last_shoot_tick( ) + 2 && !memory::read<bool>( shared_ctx.weapon + SCHEMA( "C_CSWeaponBase", "m_bInReload"_hash ) ) && memory::read<int>( shared_ctx.weapon + SCHEMA( "C_BasePlayerWeapon", "m_iClip1"_hash ) ) > 0;

        const auto should_attack = can_attack && charge_dt;

        const auto history_n = cmd->csgo_user_cmd.input_history_size( );
        for ( auto i = 0; i < history_n; ++i )
        {
            if ( const auto entry = cmd->csgo_user_cmd.mutable_input_history( i ) )
            {
                entry->set_player_tick_count( should_attack ? next_primary : 0 );
            }
        }

        if ( should_attack && !this->m_doubletap_fired )
        {
            if ( const auto subtick_moves = base_cmd->mutable_subtick_moves( ) )
            {
                if ( const auto press = systems::g_input.acquire_subtick_step( subtick_moves ) )
                {
                    press->set_button( cstypes::command_buttons::in_attack );
                    press->set_pressed( true );
                    press->set_when( 0.0f );
                    press->set_analog_forward_delta( 0.0f );
                    press->set_analog_left_delta( 0.0f );
                }

                if ( const auto release = systems::g_input.acquire_subtick_step( subtick_moves ) )
                {
                    release->set_button( cstypes::command_buttons::in_attack );
                    release->set_pressed( false );
                    release->set_when( 1.0f );
                    release->set_analog_forward_delta( 0.0f );
                    release->set_analog_left_delta( 0.0f );
                }
            }
        }
        else
        {
            cmd->buttons.value &= ~cstypes::command_buttons::in_attack;
            cmd->buttons.value_changed |= cstypes::command_buttons::in_attack;
        }

        this->m_doubletap_fired = should_attack && !this->m_doubletap_fired;

        cmd->csgo_user_cmd.set_attack1_start_history_index( -1 );
    }
i will try
 
idk but maybe work (i found other forum)

double tap:
Expand Collapse Copy
    void rage::process_doubletap( systems::input::usercmd* cmd, const systems::local::snapshot& local, bool charge_dt )
    {
        const auto& shared_ctx = g_shared.ctx( );
        const auto& config = settings::g_combat.m_ragebot.get_group( shared_ctx.weapon_type );
        if ( !config.doubletap.value )
        {
            return;
        }

        const auto base_cmd = cmd->csgo_user_cmd.mutable_base( );
        if ( !base_cmd )
        {
            return;
        }

        const auto client_tick = base_cmd->client_tick( );
        const auto next_primary = memory::read<int>( shared_ctx.weapon + SCHEMA( "C_BasePlayerWeapon", "m_nNextPrimaryAttackTick"_hash ) );
        const auto tick_base = memory::read<int>( local.controller + SCHEMA( "CBasePlayerController", "m_nTickBase"_hash ) );

        const auto can_attack = client_tick >= next_primary && tick_base >= g_shared.last_shoot_tick( ) + 2 && !memory::read<bool>( shared_ctx.weapon + SCHEMA( "C_CSWeaponBase", "m_bInReload"_hash ) ) && memory::read<int>( shared_ctx.weapon + SCHEMA( "C_BasePlayerWeapon", "m_iClip1"_hash ) ) > 0;

        const auto should_attack = can_attack && charge_dt;

        const auto history_n = cmd->csgo_user_cmd.input_history_size( );
        for ( auto i = 0; i < history_n; ++i )
        {
            if ( const auto entry = cmd->csgo_user_cmd.mutable_input_history( i ) )
            {
                entry->set_player_tick_count( should_attack ? next_primary : 0 );
            }
        }

        if ( should_attack && !this->m_doubletap_fired )
        {
            if ( const auto subtick_moves = base_cmd->mutable_subtick_moves( ) )
            {
                if ( const auto press = systems::g_input.acquire_subtick_step( subtick_moves ) )
                {
                    press->set_button( cstypes::command_buttons::in_attack );
                    press->set_pressed( true );
                    press->set_when( 0.0f );
                    press->set_analog_forward_delta( 0.0f );
                    press->set_analog_left_delta( 0.0f );
                }

                if ( const auto release = systems::g_input.acquire_subtick_step( subtick_moves ) )
                {
                    release->set_button( cstypes::command_buttons::in_attack );
                    release->set_pressed( false );
                    release->set_when( 1.0f );
                    release->set_analog_forward_delta( 0.0f );
                    release->set_analog_left_delta( 0.0f );
                }
            }
        }
        else
        {
            cmd->buttons.value &= ~cstypes::command_buttons::in_attack;
            cmd->buttons.value_changed |= cstypes::command_buttons::in_attack;
        }

        this->m_doubletap_fired = should_attack && !this->m_doubletap_fired;

        cmd->csgo_user_cmd.set_attack1_start_history_index( -1 );
    }
thank you,it is working, but There's no logic for aiming angle calculation, target selection, or trajectory correction anywhere in the whole code. and use set_attack1_start_history_index( -1 ); again
 

Who has read this thread (Total: 1) in last 1 hours View details