• Ищем качественного (не новичок) разработчиков Xenforo для этого форума! В идеале, чтобы ты был фулл стек программистом. Если у тебя есть что показать, то свяжись с нами по контактным данным: https://t.me/DREDD

C++ Converted supremacy(by simvol) directional strafer to lw

  • Автор темы Автор темы Tcugan
  • Дата начала Дата начала
Забаненный
Забаненный
Статус
Оффлайн
Регистрация
2 Июн 2020
Сообщения
457
Реакции
80
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Код:
Expand Collapse Copy
void airstrafe::create_move(CUserCmd* m_pcmd, Vector wish_yaw)
{
    Vector velocity;
    float  delta, abs_delta, velocity_delta, correct, m_speed, m_ideal, m_old_yaw;
    float  m_switch_value = 1.f;

    if (g_cfg.misc.airstrafe == 2)
    {

        // don't strafe while noclipping or on ladders..
        if (g_ctx.local()->get_move_type() == MOVETYPE_NOCLIP || g_ctx.local()->get_move_type() == MOVETYPE_LADDER)
            return;

        // disable strafing while pressing shift.
        // don't strafe if not holding primary jump key.
        if ((m_pcmd->m_buttons & IN_SPEED) || !(m_pcmd->m_buttons & IN_JUMP) || (g_ctx.local()->m_fFlags() & FL_ONGROUND))
            return;

        // get networked velocity ( maybe absvelocity better here? ).
        // meh, should be predicted anyway? ill see.
        velocity = g_ctx.local()->m_vecVelocity();

        // get the velocity len2d ( speed ).
        m_speed = velocity.Length2D();

        // compute the ideal strafe angle for our velocity.
        m_ideal = (m_speed > 0.f) ? RAD2DEG(asin(15.f / m_speed)) : 90.f;

        // some additional sanity.
        math::clamp(m_ideal, 0.f, 90.f);

        // for changing direction.
        // we want to change strafe direction every call.
        m_switch_value *= -1.f;

        bool m_pressing_move = ((m_pcmd->m_buttons & IN_LEFT) || (m_pcmd->m_buttons & IN_FORWARD) || (m_pcmd->m_buttons & IN_BACK) || (m_pcmd->m_buttons & IN_RIGHT) || (m_pcmd->m_buttons & IN_MOVELEFT) || (m_pcmd->m_buttons & IN_MOVERIGHT) || (m_pcmd->m_buttons & IN_JUMP));

        if (m_pressing_move)
        {
            // get our key presses.
            bool holding_w = m_pcmd->m_buttons & IN_FORWARD;
            bool holding_a = m_pcmd->m_buttons & IN_MOVELEFT;
            bool holding_s = m_pcmd->m_buttons & IN_BACK;
            bool holding_d = m_pcmd->m_buttons & IN_MOVERIGHT;

            float direction{ };

            // move in the appropriate direction.
            if (holding_w) {
                if (holding_a)
                    direction += 45.f;
                else if (holding_d)
                    direction -= 45.f;
            }
            else if (holding_s) {
                if (holding_a)
                    direction += 135.f;
                else if (holding_d)
                    direction -= 135.f;
                else
                    direction += 180.f;
            }
            else if (holding_a)
                direction += 90.f;
            else if (holding_d)
                direction -= 90.f;

            wish_yaw.y = math::normalize_yaw(wish_yaw.y + direction);
        }

        // cancel out any forwardmove values.
        m_pcmd->m_forwardmove = 0.f;

        // get our viewangle change.
        delta = math::normalize_yaw(wish_yaw.y - m_old_yaw);

        // convert to absolute change.
        abs_delta = abs(delta);

        // save old yaw for next call.
        m_old_yaw = wish_yaw.y;

        // set strafe direction based on mouse direction change.
        if (delta > 0.f)
            m_pcmd->m_sidemove = -450.f;
        else if (delta < 0.f)
            m_pcmd->m_sidemove = 450.f;

        // we can accelerate more, because we strafed less then needed
        // or we got of track and need to be retracked.
        if (abs_delta <= m_ideal || abs_delta >= 30.f)
        {
            // compute angle of the direction we are traveling in.
            QAngle velocity_angle;
            math::VectorAngles(velocity, velocity_angle);

            // get the delta between our direction and where we are looking at.
            velocity_delta = math::normalize_yaw(wish_yaw.y - velocity_angle.yaw);

            // correct our strafe amongst the path of a circle.
            correct = m_ideal;

            if (velocity_delta <= correct || m_speed <= 15.f)
            {
                // not moving mouse, switch strafe every tick.
                if (-correct <= velocity_delta || m_speed <= 15.f) {
                    wish_yaw.y += (m_ideal * m_switch_value);
                    m_pcmd->m_sidemove = 450.f * m_switch_value;
                }

                else {
                    wish_yaw.y = velocity_angle.yaw - correct;
                    m_pcmd->m_sidemove = 450.f;
                }
            }

            else {
                wish_yaw.y = velocity_angle.yaw + correct;
                m_pcmd->m_sidemove = -450.f;
            }
        }
    }
}
 
блестяще
 
Код:
Expand Collapse Copy
void airstrafe::create_move(CUserCmd* m_pcmd, Vector wish_yaw)
{
    Vector velocity;
    float  delta, abs_delta, velocity_delta, correct, m_speed, m_ideal, m_old_yaw;
    float  m_switch_value = 1.f;

    if (g_cfg.misc.airstrafe == 2)
    {

        // don't strafe while noclipping or on ladders..
        if (g_ctx.local()->get_move_type() == MOVETYPE_NOCLIP || g_ctx.local()->get_move_type() == MOVETYPE_LADDER)
            return;

        // disable strafing while pressing shift.
        // don't strafe if not holding primary jump key.
        if ((m_pcmd->m_buttons & IN_SPEED) || !(m_pcmd->m_buttons & IN_JUMP) || (g_ctx.local()->m_fFlags() & FL_ONGROUND))
            return;

        // get networked velocity ( maybe absvelocity better here? ).
        // meh, should be predicted anyway? ill see.
        velocity = g_ctx.local()->m_vecVelocity();

        // get the velocity len2d ( speed ).
        m_speed = velocity.Length2D();

        // compute the ideal strafe angle for our velocity.
        m_ideal = (m_speed > 0.f) ? RAD2DEG(asin(15.f / m_speed)) : 90.f;

        // some additional sanity.
        math::clamp(m_ideal, 0.f, 90.f);

        // for changing direction.
        // we want to change strafe direction every call.
        m_switch_value *= -1.f;

        bool m_pressing_move = ((m_pcmd->m_buttons & IN_LEFT) || (m_pcmd->m_buttons & IN_FORWARD) || (m_pcmd->m_buttons & IN_BACK) || (m_pcmd->m_buttons & IN_RIGHT) || (m_pcmd->m_buttons & IN_MOVELEFT) || (m_pcmd->m_buttons & IN_MOVERIGHT) || (m_pcmd->m_buttons & IN_JUMP));

        if (m_pressing_move)
        {
            // get our key presses.
            bool holding_w = m_pcmd->m_buttons & IN_FORWARD;
            bool holding_a = m_pcmd->m_buttons & IN_MOVELEFT;
            bool holding_s = m_pcmd->m_buttons & IN_BACK;
            bool holding_d = m_pcmd->m_buttons & IN_MOVERIGHT;

            float direction{ };

            // move in the appropriate direction.
            if (holding_w) {
                if (holding_a)
                    direction += 45.f;
                else if (holding_d)
                    direction -= 45.f;
            }
            else if (holding_s) {
                if (holding_a)
                    direction += 135.f;
                else if (holding_d)
                    direction -= 135.f;
                else
                    direction += 180.f;
            }
            else if (holding_a)
                direction += 90.f;
            else if (holding_d)
                direction -= 90.f;

            wish_yaw.y = math::normalize_yaw(wish_yaw.y + direction);
        }

        // cancel out any forwardmove values.
        m_pcmd->m_forwardmove = 0.f;

        // get our viewangle change.
        delta = math::normalize_yaw(wish_yaw.y - m_old_yaw);

        // convert to absolute change.
        abs_delta = abs(delta);

        // save old yaw for next call.
        m_old_yaw = wish_yaw.y;

        // set strafe direction based on mouse direction change.
        if (delta > 0.f)
            m_pcmd->m_sidemove = -450.f;
        else if (delta < 0.f)
            m_pcmd->m_sidemove = 450.f;

        // we can accelerate more, because we strafed less then needed
        // or we got of track and need to be retracked.
        if (abs_delta <= m_ideal || abs_delta >= 30.f)
        {
            // compute angle of the direction we are traveling in.
            QAngle velocity_angle;
            math::VectorAngles(velocity, velocity_angle);

            // get the delta between our direction and where we are looking at.
            velocity_delta = math::normalize_yaw(wish_yaw.y - velocity_angle.yaw);

            // correct our strafe amongst the path of a circle.
            correct = m_ideal;

            if (velocity_delta <= correct || m_speed <= 15.f)
            {
                // not moving mouse, switch strafe every tick.
                if (-correct <= velocity_delta || m_speed <= 15.f) {
                    wish_yaw.y += (m_ideal * m_switch_value);
                    m_pcmd->m_sidemove = 450.f * m_switch_value;
                }

                else {
                    wish_yaw.y = velocity_angle.yaw - correct;
                    m_pcmd->m_sidemove = 450.f;
                }
            }

            else {
                wish_yaw.y = velocity_angle.yaw + correct;
                m_pcmd->m_sidemove = -450.f;
            }
        }
    }
}
если че если софт называется supremacy это не значит что он ахуенный и в коде который ты пастишь нет проблем
 
Код:
Expand Collapse Copy
void airstrafe::create_move(CUserCmd* m_pcmd, Vector wish_yaw)
{
    Vector velocity;
    float  delta, abs_delta, velocity_delta, correct, m_speed, m_ideal, m_old_yaw;
    float  m_switch_value = 1.f;

    if (g_cfg.misc.airstrafe == 2)
    {

        // don't strafe while noclipping or on ladders..
        if (g_ctx.local()->get_move_type() == MOVETYPE_NOCLIP || g_ctx.local()->get_move_type() == MOVETYPE_LADDER)
            return;

        // disable strafing while pressing shift.
        // don't strafe if not holding primary jump key.
        if ((m_pcmd->m_buttons & IN_SPEED) || !(m_pcmd->m_buttons & IN_JUMP) || (g_ctx.local()->m_fFlags() & FL_ONGROUND))
            return;

        // get networked velocity ( maybe absvelocity better here? ).
        // meh, should be predicted anyway? ill see.
        velocity = g_ctx.local()->m_vecVelocity();

        // get the velocity len2d ( speed ).
        m_speed = velocity.Length2D();

        // compute the ideal strafe angle for our velocity.
        m_ideal = (m_speed > 0.f) ? RAD2DEG(asin(15.f / m_speed)) : 90.f;

        // some additional sanity.
        math::clamp(m_ideal, 0.f, 90.f);

        // for changing direction.
        // we want to change strafe direction every call.
        m_switch_value *= -1.f;

        bool m_pressing_move = ((m_pcmd->m_buttons & IN_LEFT) || (m_pcmd->m_buttons & IN_FORWARD) || (m_pcmd->m_buttons & IN_BACK) || (m_pcmd->m_buttons & IN_RIGHT) || (m_pcmd->m_buttons & IN_MOVELEFT) || (m_pcmd->m_buttons & IN_MOVERIGHT) || (m_pcmd->m_buttons & IN_JUMP));

        if (m_pressing_move)
        {
            // get our key presses.
            bool holding_w = m_pcmd->m_buttons & IN_FORWARD;
            bool holding_a = m_pcmd->m_buttons & IN_MOVELEFT;
            bool holding_s = m_pcmd->m_buttons & IN_BACK;
            bool holding_d = m_pcmd->m_buttons & IN_MOVERIGHT;

            float direction{ };

            // move in the appropriate direction.
            if (holding_w) {
                if (holding_a)
                    direction += 45.f;
                else if (holding_d)
                    direction -= 45.f;
            }
            else if (holding_s) {
                if (holding_a)
                    direction += 135.f;
                else if (holding_d)
                    direction -= 135.f;
                else
                    direction += 180.f;
            }
            else if (holding_a)
                direction += 90.f;
            else if (holding_d)
                direction -= 90.f;

            wish_yaw.y = math::normalize_yaw(wish_yaw.y + direction);
        }

        // cancel out any forwardmove values.
        m_pcmd->m_forwardmove = 0.f;

        // get our viewangle change.
        delta = math::normalize_yaw(wish_yaw.y - m_old_yaw);

        // convert to absolute change.
        abs_delta = abs(delta);

        // save old yaw for next call.
        m_old_yaw = wish_yaw.y;

        // set strafe direction based on mouse direction change.
        if (delta > 0.f)
            m_pcmd->m_sidemove = -450.f;
        else if (delta < 0.f)
            m_pcmd->m_sidemove = 450.f;

        // we can accelerate more, because we strafed less then needed
        // or we got of track and need to be retracked.
        if (abs_delta <= m_ideal || abs_delta >= 30.f)
        {
            // compute angle of the direction we are traveling in.
            QAngle velocity_angle;
            math::VectorAngles(velocity, velocity_angle);

            // get the delta between our direction and where we are looking at.
            velocity_delta = math::normalize_yaw(wish_yaw.y - velocity_angle.yaw);

            // correct our strafe amongst the path of a circle.
            correct = m_ideal;

            if (velocity_delta <= correct || m_speed <= 15.f)
            {
                // not moving mouse, switch strafe every tick.
                if (-correct <= velocity_delta || m_speed <= 15.f) {
                    wish_yaw.y += (m_ideal * m_switch_value);
                    m_pcmd->m_sidemove = 450.f * m_switch_value;
                }

                else {
                    wish_yaw.y = velocity_angle.yaw - correct;
                    m_pcmd->m_sidemove = 450.f;
                }
            }

            else {
                wish_yaw.y = velocity_angle.yaw + correct;
                m_pcmd->m_sidemove = -450.f;
            }
        }
    }
}
для идиота как ты я тебе скажу секрет,это не автострейф символа, а автострейф с пандоры
 
а wishyaw это че? точнее как его запастить у меня в hooked_createmove тока аргумент m_pcmd туда подается

upd : разобрался, там такая переменная уже была)
 
а wishyaw это че? точнее как его запастить у меня в hooked_createmove тока аргумент m_pcmd туда подается

upd : разобрался, там такая переменная уже была)
вот поэтому те кто создают такие темы просто блестящие люди
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
вот поэтому те кто создают такие темы просто блестящие люди
не не не, просто у чела нету мозгов, в дефолтном лв уже есть переменная в креатмуве виш яв-__________-
 
дай VectorAngles в math.cpp
 
дай VectorAngles в math.cpp
 
жесть конечно а почему не пропер то
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Парни не тупите, все не достающее пиздите с мяса
 
Назад
Сверху Снизу