Подпишитесь на наш Telegram-канал, чтобы всегда быть в курсе важных обновлений! Перейти

Исходник Fixed modelchanger [WEAVE.SU]

owness developer
Забаненный
Забаненный
Статус
Оффлайн
Регистрация
25 Авг 2020
Сообщения
72
Реакции
58
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
пофикшено пропадание рук
пофикшено ломание десинк чамсов
переменную m_need_update можете удалить, делал ее для дебага одного прикола, который ловил после нажатию кнопки full update в меню

C++:
Expand Collapse Copy
void CVisuals::agent_changer(ClientFrameStage_t stage) {

    static int originalIdx = 0;
    bool m_need_update = false;


    auto pLocal = static_cast <IBasePlayer*> (interfaces.ent_list->GetClientEntity(interfaces.engine->GetLocalPlayer()));

    if (!pLocal) {

        originalIdx = 0;

        return;

    }

    constexpr auto getModel = [](int team) constexpr ->

        const char* {

        constexpr std::array models{

          "models/player/custom_player/legacy/ctm_fbi_variantb.mdl",

          "models/player/custom_player/legacy/ctm_fbi_variantf.mdl",

          "models/player/custom_player/legacy/ctm_fbi_variantg.mdl",

          "models/player/custom_player/legacy/ctm_fbi_varianth.mdl",

          "models/player/custom_player/legacy/ctm_st6_variante.mdl",

          "models/player/custom_player/legacy/ctm_st6_variantg.mdl",

          "models/player/custom_player/legacy/ctm_st6_varianti.mdl",

          "models/player/custom_player/legacy/ctm_st6_variantk.mdl",

          "models/player/custom_player/legacy/ctm_st6_variantm.mdl",

          "models/player/custom_player/legacy/ctm_sas_variantf.mdl",

          "models/player/custom_player/legacy/tm_leet_variantf.mdl",

          "models/player/custom_player/legacy/tm_leet_varianti.mdl",

          "models/player/custom_player/legacy/tm_leet_varianth.mdl",

          "models/player/custom_player/legacy/tm_leet_variantg.mdl",

          "models/player/custom_player/legacy/tm_balkan_variantf.mdl",

          "models/player/custom_player/legacy/tm_balkan_variantg.mdl",

          "models/player/custom_player/legacy/tm_balkan_varianth.mdl",

          "models/player/custom_player/legacy/tm_balkan_varianti.mdl",

          "models/player/custom_player/legacy/tm_balkan_variantj.mdl",

          "models/player/custom_player/legacy/tm_phoenix_variantf.mdl",

          "models/player/custom_player/legacy/tm_phoenix_variantg.mdl",

          "models/player/custom_player/legacy/tm_phoenix_varianth.mdl",

          "models/player/custom_player/legacy/ctm_heavy.mdl",

        };



        switch (team) {

        case 2:

            return static_cast <std::size_t> (vars.misc.agents_t - 1) < models.size() ? models[vars.misc.agents_t - 1] : nullptr;

        case 3:

            return static_cast <std::size_t> (vars.misc.agents_ct - 1) < models.size() ? models[vars.misc.agents_ct - 1] : nullptr;

        default:

            return nullptr;

        }

    };

    if (const auto model = getModel(pLocal->GetTeam())) {

        if (stage == ClientFrameStage_t::FRAME_RENDER_START)

            originalIdx = pLocal->m_nModelIndex();



        const auto idx = stage == ClientFrameStage_t::FRAME_RENDER_END && originalIdx ? originalIdx : interfaces.models.model_info->GetModelIndex(model);



        pLocal->SetModelIndex(idx);

        m_need_update = true;

        if (interfaces.engine->IsInGame() && interfaces.engine->IsConnected())
        {
            interfaces.engine->ExecuteClientCmd("cl_fullupdate"); // call models update
        }

        m_need_update = false;


        if (const auto ragdoll = interfaces.ent_list->GetClientEntityFromHandle(csgo->local->ragdoll()))

            ragdoll->SetModelIndex(idx);

        m_need_update = true;

        if (interfaces.engine->IsInGame() && interfaces.engine->IsConnected())
        {
            interfaces.engine->ExecuteClientCmd("cl_fullupdate"); // call models update
        }

        m_need_update = false;


    }


}
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
найс спиздил тему другово чела
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
это что за приколы?
Код:
Expand Collapse Copy
  if (interfaces.engine->IsInGame() && interfaces.engine->IsConnected())
        {
            interfaces.engine->ExecuteClientCmd("cl_fullupdate"); // call models update
        }

        m_need_update = false;


        if (const auto ragdoll = interfaces.ent_list->GetClientEntityFromHandle(csgo->local->ragdoll()))

            ragdoll->SetModelIndex(idx);

        m_need_update = true;

        if (interfaces.engine->IsInGame() && interfaces.engine->IsConnected())
        {
            interfaces.engine->ExecuteClientCmd("cl_fullupdate"); // call models update
        }

        m_need_update = false;
Сейчас бы constexpr const char* выдавливать как size_t , бля,у тебя все норм или ты приколист?
Код:
Expand Collapse Copy
 constexpr auto getModel = [](int team) constexpr ->

        const char* {
Код:
Expand Collapse Copy
 return static_cast <std::size_t> (vars.misc.agents_ct - 1) < models.size() ? models[vars.misc.agents_ct - 1] : nullptr;

Про дрочь с стейджами тоже очень интересно,однако. Нахуя вся эта дичь?

Блять,да сделайте вы уже по-божески просто...

Код:
Expand Collapse Copy
void CVisuals::agent_changer(ClientFrameStage_t stage)
{
    constexpr const char* models[] =
    {
      "models/player/custom_player/legacy/ctm_fbi_variantb.mdl",
      "models/player/custom_player/legacy/ctm_fbi_variantf.mdl",
      "models/player/custom_player/legacy/ctm_fbi_variantg.mdl",
      "models/player/custom_player/legacy/ctm_fbi_varianth.mdl",
      "models/player/custom_player/legacy/ctm_st6_variante.mdl",
      "models/player/custom_player/legacy/ctm_st6_variantg.mdl",
      "models/player/custom_player/legacy/ctm_st6_varianti.mdl",
      "models/player/custom_player/legacy/ctm_st6_variantk.mdl",
      "models/player/custom_player/legacy/ctm_st6_variantm.mdl",
      "models/player/custom_player/legacy/ctm_sas_variantf.mdl",
      "models/player/custom_player/legacy/tm_leet_variantf.mdl",
      "models/player/custom_player/legacy/tm_leet_varianti.mdl",
      "models/player/custom_player/legacy/tm_leet_varianth.mdl",
      "models/player/custom_player/legacy/tm_leet_variantg.mdl",
      "models/player/custom_player/legacy/tm_balkan_variantf.mdl",
      "models/player/custom_player/legacy/tm_balkan_variantg.mdl",
      "models/player/custom_player/legacy/tm_balkan_varianth.mdl",
      "models/player/custom_player/legacy/tm_balkan_varianti.mdl",
      "models/player/custom_player/legacy/tm_balkan_variantj.mdl",
      "models/player/custom_player/legacy/tm_phoenix_variantf.mdl",
      "models/player/custom_player/legacy/tm_phoenix_variantg.mdl",
      "models/player/custom_player/legacy/tm_phoenix_varianth.mdl",
      "models/player/custom_player/legacy/ctm_heavy.mdl",
    };

    if (stage != FRAME_NET_UPDATE_POSTDATAUPDATE_START)
    {
        return;
    }

   const  auto pLocal = static_cast<IBasePlayer*>(interfaces.ent_list->GetClientEntity(interfaces.engine->GetLocalPlayer()));

    if (!pLocal)
    {
        return;
    } 

   auto ret_mdl = pLocal->GetTeam() == 2 ? models[vars.misc.agents_t] : models[vars.misc.agents_ct];
  
    if (auto ret_idx = interfaces.models.model_info->GetModelIndex(ret_mdl);)
    {
        pLocal->SetModelIndex(ret_idx);

        if (const auto ragdoll = interfaces.ent_list->GetClientEntityFromHandle(csgo->local->ragdoll()))
        {
            ragdoll->SetModelIndex(ret_idx);
        }         
    }
}
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
это что за приколы?
Код:
Expand Collapse Copy
  if (interfaces.engine->IsInGame() && interfaces.engine->IsConnected())
        {
            interfaces.engine->ExecuteClientCmd("cl_fullupdate"); // call models update
        }

        m_need_update = false;


        if (const auto ragdoll = interfaces.ent_list->GetClientEntityFromHandle(csgo->local->ragdoll()))

            ragdoll->SetModelIndex(idx);

        m_need_update = true;

        if (interfaces.engine->IsInGame() && interfaces.engine->IsConnected())
        {
            interfaces.engine->ExecuteClientCmd("cl_fullupdate"); // call models update
        }

        m_need_update = false;
Сейчас бы constexpr const char* выдавливать как size_t , бля,у тебя все норм или ты приколист?
Код:
Expand Collapse Copy
 constexpr auto getModel = [](int team) constexpr ->

        const char* {
Код:
Expand Collapse Copy
 return static_cast <std::size_t> (vars.misc.agents_ct - 1) < models.size() ? models[vars.misc.agents_ct - 1] : nullptr;

Про дрочь с стейджами тоже очень интересно,однако. Нахуя вся эта дичь?

Блять,да сделайте вы уже по-божески просто...

Код:
Expand Collapse Copy
void CVisuals::agent_changer(ClientFrameStage_t stage)
{
    constexpr const char* models[] =
    {
      "models/player/custom_player/legacy/ctm_fbi_variantb.mdl",
      "models/player/custom_player/legacy/ctm_fbi_variantf.mdl",
      "models/player/custom_player/legacy/ctm_fbi_variantg.mdl",
      "models/player/custom_player/legacy/ctm_fbi_varianth.mdl",
      "models/player/custom_player/legacy/ctm_st6_variante.mdl",
      "models/player/custom_player/legacy/ctm_st6_variantg.mdl",
      "models/player/custom_player/legacy/ctm_st6_varianti.mdl",
      "models/player/custom_player/legacy/ctm_st6_variantk.mdl",
      "models/player/custom_player/legacy/ctm_st6_variantm.mdl",
      "models/player/custom_player/legacy/ctm_sas_variantf.mdl",
      "models/player/custom_player/legacy/tm_leet_variantf.mdl",
      "models/player/custom_player/legacy/tm_leet_varianti.mdl",
      "models/player/custom_player/legacy/tm_leet_varianth.mdl",
      "models/player/custom_player/legacy/tm_leet_variantg.mdl",
      "models/player/custom_player/legacy/tm_balkan_variantf.mdl",
      "models/player/custom_player/legacy/tm_balkan_variantg.mdl",
      "models/player/custom_player/legacy/tm_balkan_varianth.mdl",
      "models/player/custom_player/legacy/tm_balkan_varianti.mdl",
      "models/player/custom_player/legacy/tm_balkan_variantj.mdl",
      "models/player/custom_player/legacy/tm_phoenix_variantf.mdl",
      "models/player/custom_player/legacy/tm_phoenix_variantg.mdl",
      "models/player/custom_player/legacy/tm_phoenix_varianth.mdl",
      "models/player/custom_player/legacy/ctm_heavy.mdl",
    };

    if (stage != FRAME_NET_UPDATE_POSTDATAUPDATE_START)
    {
        return;
    }

    auto pLocal = static_cast<IBasePlayer*>(interfaces.ent_list->GetClientEntity(interfaces.engine->GetLocalPlayer()));

    if (!pLocal)
    {
        return;
    } 

    auto ret_mdl = pLocal->GetTeam() == 2 ? models[vars.misc.agents_t] : models[vars.misc.agents_ct];
  
    if (auto ret_idx = interfaces.models.model_info->GetModelIndex(ret_mdl);)
    {
        pLocal->SetModelIndex(ret_idx);

        if (const auto ragdoll = interfaces.ent_list->GetClientEntityFromHandle(csgo->local->ragdoll()))
        {
            ragdoll->SetModelIndex(ret_idx);
        }         
    }
}
по поводу остального кода кроме апдейта вопросы не ко мне, а к @pMovement
Скрытое содержимое
принимай
 
Ok this is enough i guess, still people can't understand why their P models are flickering.
You don't need to change P model in FRAME_NET_UPDATE_END, stop pasting from Osiris, use your brain.

Example how it should be
C++:
Expand Collapse Copy
    if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
    {
        g_cl.m_local->SetModelIndex(g_csgo.m_model_info->GetModelIndex("models/player/custom_player/legacy/ctm_fbi_variantb.mdl"));   
        
        Ragdoll* ragdoll = g_cl.m_local->as< Ragdoll* >();
        
        if(ragdoll)
            ragdoll->SetModelIndex(g_csgo.m_model_info->GetModelIndex("models/player/custom_player/legacy/ctm_fbi_variantb.mdl"));
    }
 
Назад
Сверху Снизу