What's new

Welcome to HvH Forum!

SignUp Now! Download Free HvH CS:GO Cheats, CFG, LUA/JS Scripts, And More!


SignUp Now!

Source Code fixvelocity from cheesehack

Newbie HvHer
User ID
36253
Messages
3
Reactions
0
Level
3
reversed by ttx (moneybot beta)

C++:
void FixVelocity(Player* m_player, LagRecord* record, LagRecord* previous, float max_speed, float a3) {

    float v5;

    float v10;

    v5 = a3;

    float y;

    float z; // xmm6_4

    float v12; // xmm0_4

    float v13; // xmm3_4

    float v14; // xmm5_4

    float v15; // xmm6_4

    float v16; // xmm7_4

    if (!previous)

    {

        if (record->m_layers[6].m_playback_rate <= 0.0

            || (record->m_layers[6].m_weight = record->m_layers[6].m_weight, record->m_layers[6].m_weight == 0.0)

            || (y = record->m_velocity.y,

                v10 = record->m_velocity.x,

                z = record->m_velocity.z,

                v12 = record->m_velocity.length() > 0.1f))

  

        {

            v14 = 0.0;

            v15 = 0.0;

            v16 = 0.0;

        }

        else

        {

            if ((record->m_flags & 6) != 0)

            {

                v5 = v5 * 0.34;

            }

            else if (m_player->m_bIsWalking())

            {

                v5 = v5 * 0.51999998;

            }

            v13 = (float)(record->m_layers[6].m_weight * v5) / v12;

            v14 = v10 * v13;

            v15 = z * v13;

            v16 = y * v13;

        }

        record->m_velocity.y = v16;

        record->m_velocity.z = v15;

        record->m_velocity.x = v14;

        if ((record->m_flags & 1) != 0)

            record->m_velocity.z = 0.0;

        record->m_anim_velocity = record->m_velocity;

        return;

    }

    if ((m_player->m_fEffects() & 8) != 0

        || m_player->m_ubEFNoInterpParity() != m_player->m_ubEFNoInterpParityOld()) {

        record->m_velocity.clear();

        record->m_anim_velocity.clear();

        return;

  

        record->m_velocity.z = 0.0;

        record->m_velocity.y = 0.0;

        record->m_velocity.x = 0.0;

    LABEL_63:

        record->m_anim_velocity.x = 0.0;

        record->m_anim_velocity.y = 0.0;

        record->m_anim_velocity.z = 0.0;

        return;

    }

    bool v18; // zf

    char a4_3; // [esp+33h] [ebp+Bh]

    if ((record->m_flags & 1) == 0 || (v18 = (previous->m_flags & 1) == 0, a4_3 = 0, v18))

        a4_3 = 1;

    if (record->m_lag <= 1)



        record->m_velocity.z = 0.0;

    record->m_velocity.y = 0.0;

    record->m_velocity.x = 0.0;

    float v19; // xmm5_4

    float v20; // xmm6_4

    float v21; // xmm4_4

    int v22; // eax

    float v23; // xmm0_4

    float v24; // xmm2_4

    float v25; // xmm1_4



    v19 = record->m_origin.x - previous->m_origin.x;

    v20 = record->m_origin.y - previous->m_origin.y;

    v21 = record->m_origin.z - previous->m_origin.z;

    if ((previous->m_flags & 1) == 0 && (record->m_flags & 1) == 0)

    {

        v22 = record->m_flags & 2;

        if ((previous->m_flags & 2) != v22)

        {

            if (v22)

                v23 = 9.0;

            else

                v23 = -9.0;

            v21 = v21 - v23;

        }

    }

}
 
COCABOSS2017
User ID
34152
Messages
13
Reactions
4
Level
6
whats the value of a3? for max_speed its 260 but idk how for a3
 
Rookie HvHer
User ID
11679
Messages
68
Reactions
19
Level
10
whats the value of a3? for max_speed its 260 but idk how for a3
eerrrrrrmmmm. if u know how to read, u can see that the float max_speed is never used. I'm assuming a3 is the max_speed. 🤓🤓🤓🤓🤓🤓🤓🤓
 
COCABOSS2017
User ID
34152
Messages
13
Reactions
4
Level
6
i mean how to use it there for example
// fix velocity.
float max_speed = 260.f;
if (record->m_lag > 0 && record->m_lag < 16 && m_records.size() >= 2) {
FixVelocity(m_player, record, previous, max_speed, a3);
 
Master HvHer
User ID
20083
Messages
52
Reactions
598
Level
26
ok
fixvelocity from notcheesehack


C++:
const float max_speed = m_weapon ? fmaxf(m_weapon->max_speed(), 0.001f) : 260.f;

        if (previous) {
            const auto& cur_adjust_layer = m_anim_layers.at(3u);
            const auto& prev_adjust_layer = previous->m_anim_layers.at(3u);
            const auto& cur_jump_or_fall_layer = m_anim_layers.at(4u);
            const auto& prev_jump_or_fall_layer = previous->m_anim_layers.at(4u);
            const auto& cur_land_or_climb_layer = m_anim_layers.at(5u);
            const auto& prev_land_or_climb_layer = previous->m_anim_layers.at(5u);
            const auto& cur_movement_move_layer = m_anim_layers.at(6u);
            const auto& prev_movement_move_layer = previous->m_anim_layers.at(6u);
            const auto& cur_movement_strafe_change_layer = m_anim_layers.at(7u);
            const auto& prev_movement_strafe_change_layer = previous->m_anim_layers.at(7u);
            const auto& cur_alive_loop_layer = m_anim_layers.at(11u);
            const auto& prev_alive_loop_layer = previous->m_anim_layers.at(11u);

            float animation_velocity;

            m_velocity = (m_origin - previous->m_origin) * (1.f / valve::to_time(m_sim_ticks));

            if (cur_movement_move_layer.m_playback_rate < 0.00001f)
                m_velocity.x = m_velocity.y = 0.f;
            else {
                float weight = cur_alive_loop_layer.m_weight;
                if (weight < 1.f
                    && cur_alive_loop_layer.m_playback_rate == prev_alive_loop_layer.m_playback_rate
                    && cur_alive_loop_layer.m_sequence == prev_alive_loop_layer.m_sequence
                    && cur_alive_loop_layer.m_cycle > prev_alive_loop_layer.m_cycle
                    && m_weapon == previous->m_weapon) {
                    const float speed_as_portion_of_run_top_speed = ((1.f - weight) * 0.35f) + 0.55f;
                    if (speed_as_portion_of_run_top_speed > 0.55f && speed_as_portion_of_run_top_speed < 0.9f)
                        animation_velocity = speed_as_portion_of_run_top_speed * max_speed;
                    else if (speed_as_portion_of_run_top_speed > 0.9f)
                        animation_velocity = m_velocity.length_2d();
                }

                if (animation_velocity <= 0.f) {
                    float weight = cur_movement_move_layer.m_weight;
                    if (weight > 0.1f && weight < 0.9f
                        && cur_land_or_climb_layer.m_weight <= 0.f
                        && weight > prev_movement_move_layer.m_weight
                        && cur_adjust_layer.m_sequence == prev_adjust_layer.m_sequence
                        && cur_land_or_climb_layer.m_sequence == prev_land_or_climb_layer.m_sequence
                        && cur_movement_move_layer.m_sequence == prev_movement_move_layer.m_sequence
                        && cur_movement_strafe_change_layer.m_sequence == prev_movement_strafe_change_layer.m_sequence
                        && (m_flags & valve::e_ent_flags::on_ground)) {
                        float speed_modifier = 1.f;
                        if (m_flags & valve::e_ent_flags::ducking)
                            speed_modifier = 0.34f; // CS_PLAYER_SPEED_DUCK_MODIFIER
                        else if (m_walking)
                            speed_modifier = 0.52f; // CS_PLAYER_SPEED_WALK_MODIFIER

                        if (speed_modifier < 1.f)
                            animation_velocity = (weight * (max_speed * speed_modifier));
                    }
                }
            }

            if (animation_velocity > 0.f) {
                const float modifier = animation_velocity / m_velocity.length_2d();
                m_velocity.x *= modifier;
                m_velocity.y *= modifier;
            }           
        }
        
        const float velocity_length = m_velocity.length();
        if (velocity_length > max_speed)
            m_velocity *= max_speed / velocity_length;
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Top