Вопрос Moneon black chams issue

Забаненный
Статус
Оффлайн
Регистрация
2 Сен 2020
Сообщения
29
Реакции[?]
3
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
1600591074906.png

Chams.cpp
C++:
#include <fstream>
#include "chams.h"
#include "../../hooks/hooks.h"
#include "../../options/options.h"
#include "../../helpers/input.h"
#include "../notify/notify.h"
#include "../../render/render.h"
#include "../../helpers/math.h"
#include "../legit_aimbot/backtrack.h"

int selected_entity;

auto global_chams_settings = settings::visuals::chams::chams_items[selected_entity];
auto global_chams_settings_ragdoll = settings::visuals::chams::chams_items_ragdoll[selected_entity];

namespace chams
{
    void init()
    {
        std::ofstream("csgo\\materials\\material_regular.vmt") << R"#("VertexLitGeneric"
{
  "$basetexture" "vgui/white_additive"
  "$ignorez"      "0"
  "$envmap"       ""
  "$nofog"        "1"
  "$model"        "1"
  "$nocull"       "0"
  "$selfillum"    "1"
  "$halflambert"  "1"
  "$znearer"      "0"
  "$flat"         "1"
}
)#";
        std::ofstream("csgo\\materials\\material_regular_walls.vmt") << R"#("VertexLitGeneric"
{
  "$basetexture" "vgui/white_additive"
  "$ignorez"      "1"
  "$envmap"       ""
  "$nofog"        "1"
  "$model"        "1"
  "$nocull"       "0"
  "$selfillum"    "1"
  "$halflambert"  "1"
  "$znearer"      "0"
  "$flat"         "1"
}
)#";

        std::ofstream("csgo\\materials\\material_glow.vmt") << R"#("VertexLitGeneric"
{
 "$additive"               "1"
 "$envmap"                 "models/effects/cube_white"
 "$envmaptint"             "[1 1 1]"
 "$envmapfresnel"          "1"
 "$envmapfresnelminmaxexp" "[0 1 2]"
 "$ignorez"                "0"
}
)#";
        std::ofstream("csgo\\materials\\material_glow_walls.vmt") << R"#("VertexLitGeneric"
{
 "$additive"               "1"
 "$envmap"                 "models/effects/cube_white"
 "$envmaptint"             "[1 1 1]"
 "$envmapfresnel"          "1"
 "$envmapfresnelminmaxexp" "[0 1 2]"
 "$ignorez"                "1"
}
)#";

        std::ofstream("csgo\\materials\\material_flat.vmt") << R"#("UnlitGeneric"
{
  "$basetexture" "vgui/white_additive"
  "$ignorez"      "0"
  "$envmap"       ""
  "$nofog"        "1"
  "$model"        "1"
  "$nocull"       "0"
  "$selfillum"    "1"
  "$halflambert"  "1"
  "$znearer"      "0"
  "$flat"         "1"
}
)#";
        std::ofstream("csgo\\materials\\material_flat_walls.vmt") << R"#("UnlitGeneric"
{
  "$basetexture" "vgui/white_additive"
  "$ignorez"      "1"
  "$envmap"       ""
  "$nofog"        "1"
  "$model"        "1"
  "$nocull"       "0"
  "$selfillum"    "1"
  "$halflambert"  "1"
  "$znearer"      "0"
  "$flat"         "1"
}
)#";

        material_regular       = g_mat_system->find_material("material_regular"      , TEXTURE_GROUP_OTHER);
        material_regular_walls = g_mat_system->find_material("material_regular_walls", TEXTURE_GROUP_OTHER);
        material_glow          = g_mat_system->find_material("material_glow"         , TEXTURE_GROUP_OTHER);
        material_glow_walls    = g_mat_system->find_material("material_glow_walls"   , TEXTURE_GROUP_OTHER);
        material_flat          = g_mat_system->find_material("material_flat"         , TEXTURE_GROUP_OTHER);
        material_flat_walls    = g_mat_system->find_material("material_flat_walls"   , TEXTURE_GROUP_OTHER);
    }

    void shutdown()
    {
        std::remove("csgo\\materials\\material_glow.vmt");
        std::remove("csgo\\materials\\material_glow_walls.vmt");
        std::remove("csgo\\materials\\material_regular.vmt");
        std::remove("csgo\\materials\\material_regular_walls.vmt");
        std::remove("csgo\\materials\\material_flat.vmt");
        std::remove("csgo\\materials\\material_flat_walls.vmt");
    }

    void scene_end_chams()
    {
        for (int i = 0; i < g_entity_list->get_highest_entity_index(); i++)
        {
            auto entity = reinterpret_cast<c_base_player*>(g_entity_list->get_client_entity(i));

            if (entity && entity != g_local_player && settings::visuals::dropped_weapon::enable)
            {
                auto client_class = entity->get_client_class();
                auto model_name = g_mdl_info->get_model_name(entity->get_model());

                if (client_class->m_ClassID == CSensorGrenadeProjectile || client_class->m_ClassID == CAK47 || client_class->m_ClassID == CDEagle || client_class->m_ClassID == CC4 ||
                    client_class->m_ClassID >= CWeaponAug && client_class->m_ClassID <= CWeaponXM1014) {
                    if (settings::visuals::dropped_weapon::chams)
                    {
                        override_mat(
                            false,
                            settings::visuals::dropped_weapon::chams_type,
                            settings::visuals::dropped_weapon::chams_color);

                        entity->draw_model(1, 255);
                    }
                }
                g_mdl_render->forced_material_override(nullptr);
            }
        }
    }
    void override_mat(bool visible_check, int type, const Color& rgba)
    {
        i_material* material = nullptr;

        switch (type)
        {
        case 0: visible_check ? material = material_regular_walls : material = material_regular; break;
        case 1: visible_check ? material = material_flat_walls : material = material_flat; break;
        case 2: visible_check ? material = material_glow_walls : material = material_glow; break;
        }

        if (type == 2)
        {
            bool found = false;
            auto pVar = material->find_var("$envmaptint", &found);
            if (found && pVar)
            {
                (*(void(__thiscall**)(int, float, float, float))(*(DWORD*)pVar + 44))((uintptr_t)pVar, rgba.r() / 255.f, rgba.g() / 255.f, rgba.b() / 255.f);
            }
        }

        material->alpha_modulate(
            rgba.a() / 255.f);

        material->color_modulate(
            rgba.r() / 255.0f,
            rgba.g() / 255.0f,
            rgba.b() / 255.0f);

        material->increment_reference_count();

        g_mdl_render->forced_material_override(material);
    }


    void dme_chams(void* ecx, void* edx, i_mat_render_context* context, const draw_model_state_t& state, const model_render_info_t& info, matrix3x4_t* matrix)
    {
        const char* ModelName = g_mdl_info->get_model_name((model_t*)info.pModel);

        if (!ModelName || !g_local_player)
            return;

        auto ent = (c_base_player*)g_entity_list->get_client_entity(info.entity_index);

        if (!ent)
            return;

        client_class* ent_class = ent->get_client_class();

        if (!ent_class)
            return;

        if (ent_class->m_ClassID == EClassId::CCSPlayer)
        {
            if (ent == g_local_player)
            {
                if (g_local_player->m_bIsScoped())
                {
                    g_render_view->set_blend(0.4f);
                }

                if (settings::visuals::chams::local_model::real && settings::misc::desync::type != 0)
                {
                    Vector fl = g_local_player->get_abs_angles2();

                    Vector cham_angle = Vector(fl.x, globals::aa::real_angle, fl.z);

                    float color[4] = { 0.8f, 0.8f, 0.8f, 0.2f };

                    if (!g_local_player->is_alive())
                        return;

                    Vector OrigAngle = g_local_player->get_abs_angles2();
                    Vector OrigOrigin = g_local_player->get_abs_origin();

                    g_local_player->set_abs_original(OrigOrigin);
                    g_local_player->set_abs_angles2(cham_angle);

                    override_mat(
                        false,
                        settings::visuals::chams::local_model::real_type,
                        settings::visuals::chams::local_model::real_color);

                    g_local_player->draw_model(0x1, 255);

                    g_local_player->set_abs_angles2(OrigAngle);
                    g_local_player->set_abs_original(OrigOrigin);

                    g_mdl_render->forced_material_override(nullptr);
                }

                if (settings::visuals::chams::chams_items[esp_types::local_player].enable)
                {
                    override_mat(
                        false,
                        settings::visuals::chams::chams_items[esp_types::local_player].chams_type,
                        settings::visuals::chams::chams_items[esp_types::local_player].visible);

                    hooks::o_draw_model_execute(ecx, context, state, info, matrix);
                }
            }
            else
            {
                const auto enemy = ent->m_iTeamNum() != g_local_player->m_iTeamNum();

                if (enemy)
                {
                    global_chams_settings = settings::visuals::chams::chams_items[esp_types::enemies];
                }
                else if (!enemy && !(ent == g_local_player))
                {
                    global_chams_settings = settings::visuals::chams::chams_items[esp_types::teammates];
                }

                if (ent->is_alive())
                {
                    if (settings::visuals::chams::backtrack::enable && backtrack::data.count(ent->ent_index()) > 0)
                    {
                        auto& data = backtrack::data.at(ent->ent_index());
                        if (data.size() > 0)
                        {
                            if (settings::visuals::chams::backtrack::type_draw == 1)
                            {
                                for (auto& record : data)
                                {
                                    if (!settings::visuals::chams::backtrack::only_visible)
                                    {
                                        override_mat(
                                            true,
                                            settings::visuals::chams::backtrack::type,
                                            settings::visuals::chams::backtrack::color_invisible);

                                        hooks::o_draw_model_execute(ecx, context, state, info, record.boneMatrix);

                                        override_mat(
                                            false,
                                            settings::visuals::chams::backtrack::type,
                                            settings::visuals::chams::backtrack::color_visible);

                                        hooks::o_draw_model_execute(ecx, context, state, info, record.boneMatrix);

                                        g_mdl_render->forced_material_override(nullptr);
                                    }
                                    else
                                    {
                                        override_mat(
                                            false,
                                            settings::visuals::chams::backtrack::type,
                                            settings::visuals::chams::backtrack::color_visible);

                                        hooks::o_draw_model_execute(ecx, context, state, info, record.boneMatrix);

                                        g_mdl_render->forced_material_override(nullptr);
                                    }
                                }
                            }
                            else if (settings::visuals::chams::backtrack::type_draw == 0)
                            {
                                auto& back = data.back();

                                if (!settings::visuals::chams::backtrack::only_visible)
                                {
                                    override_mat(
                                        true,
                                        settings::visuals::chams::backtrack::type,
                                        settings::visuals::chams::backtrack::color_invisible);

                                    hooks::o_draw_model_execute(ecx, context, state, info, back.boneMatrix);

                                    override_mat(
                                        false,
                                        settings::visuals::chams::backtrack::type,
                                        settings::visuals::chams::backtrack::color_visible);

                                    hooks::o_draw_model_execute(ecx, context, state, info, back.boneMatrix);

                                    g_mdl_render->forced_material_override(nullptr);
                                }
                                else
                                {
                                    override_mat(
                                        false,
                                        settings::visuals::chams::backtrack::type,
                                        settings::visuals::chams::backtrack::color_visible);

                                    hooks::o_draw_model_execute(ecx, context, state, info, back.boneMatrix);
                                }
                            }
                        }
                    }


                    if (!global_chams_settings.enable)
                        return;

                    if (!global_chams_settings.only_visible)
                    {
                        if (global_chams_settings.chams_type == 3)
                        {
                            override_mat(
                                true,
                                1,
                                global_chams_settings.glow_invisible);

                            hooks::o_draw_model_execute(ecx, context, state, info, matrix);

                            override_mat(
                                true,
                                global_chams_settings.chams_type,
                                global_chams_settings.invisible);

                            hooks::o_draw_model_execute(ecx, context, state, info, matrix);

                            override_mat(
                                false,
                                1,
                                global_chams_settings.glow_visible);

                            hooks::o_draw_model_execute(ecx, context, state, info, matrix);

                            override_mat(
                                false,
                                global_chams_settings.chams_type,
                                global_chams_settings.visible);
                        }
                        else
                        {
                            override_mat(
                                true,
                                global_chams_settings.chams_type,
                                global_chams_settings.invisible);

                            hooks::o_draw_model_execute(ecx, context, state, info, matrix);

                            override_mat(
                                false,
                                global_chams_settings.chams_type,
                                global_chams_settings.visible);
                        }
                    }
                    else
                    {
                        if (global_chams_settings.chams_type == 3)
                        {
                            override_mat(
                                false,
                                1,
                                global_chams_settings.glow_visible);

                            hooks::o_draw_model_execute(ecx, context, state, info, matrix);
                        }

                        override_mat(
                            false,
                            global_chams_settings.chams_type,
                            global_chams_settings.visible);
                    }
                }
            }
        }

        if (strstr(ModelName, "arms") != nullptr)
        {
            if (settings::visuals::chams::local_model::hands)
            {
                override_mat(false, settings::visuals::chams::local_model::hands_type, settings::visuals::chams::local_model::hands_color);
            }
        }
        if (strstr(ModelName, "weapons/v_") != nullptr)
        {
            if (settings::visuals::chams::local_model::weapon)
            {
                override_mat(false, settings::visuals::chams::local_model::weapon_type, settings::visuals::chams::local_model::weapon_color);
            }
        }
    }
}
 
Последнее редактирование:
Сверху Снизу