Гайд Simple Chams

  • 1,249
  • 6
  • 359
C++:
static void draw_object_hook(void* animtable_scene_object, void* dx11, void* data, int unknown_bool, void* scene_view, void* scene_layer, void* unknown_pointer, void* unknown)
{
    //scenesystem.dll 48 8B C4 48 89 50 10 55 41 56
    auto original = ...;

    static CMaterial2* invisible_material = create_material_invisible();
    static CMaterial2* visible_material = create_material_visible();

    if (!local)
        return original(animtable_scene_object, dx11, data, unknown_bool, scene_view, scene_layer, unknown_pointer, unknown);

    CMaterial2* material = *(CMaterial2**)((uintptr_t)data + 0x18);

    auto name = material->get_name();

    void* object_info = *(void**)((uintptr_t)data + 0x48);

    bool is_weapon = strstr(name, "weapon");

    int id = *(int*)((uintptr_t)object_info + 0xb0); //player ct 113, player t 104, arm 38

    if (!(is_weapon || id == 113 || id == 104 || id == 38))
        return original(animtable_scene_object, dx11, data, unknown_bool, scene_view, scene_layer, unknown_pointer, unknown);

    switch (id)
    {
    case 113:
        if (config.chams_enable[0] && cs.local->team() == 2)
        {
            if (config.invisible_enable)
            {
                *(CMaterial2**)((uintptr_t)data + 0x18) = invisible_material;
                set_color(data, config.invisible_color);
                original(animtable_scene_object, dx11, data, unknown_bool, scene_view, scene_layer, unknown_pointer, unknown);
            }

            *(CMaterial2**)((uintptr_t)data + 0x18) = visible_material;
            set_color(data, config.chams_color[0]);
            original(animtable_scene_object, dx11, data, unknown_bool, scene_view, scene_layer, unknown_pointer, unknown);

        }
        break;
    case 104:
        if (config.chams_enable[0] && cs.local->team() == 3)
        {
            if (config.invisible_enable)
            {
                *(CMaterial2**)((uintptr_t)data + 0x18) = invisible_material;
                set_color(data, config.invisible_color);
                original(animtable_scene_object, dx11, data, unknown_bool, scene_view, scene_layer, unknown_pointer, unknown);
            }

            *(CMaterial2**)((uintptr_t)data + 0x18) = visible_material;
            set_color(data, config.chams_color[0]);
            original(animtable_scene_object, dx11, data, unknown_bool, scene_view, scene_layer, unknown_pointer, unknown);

        }
        break;
    case 38:
        if (config.chams_enable[1])
        {
            *(CMaterial2**)((uintptr_t)data + 0x18) = visible_material;
            set_color(data, config.chams_color[1]);
            original(animtable_scene_object, dx11, data, unknown_bool, scene_view, scene_layer, unknown_pointer, unknown);
        }
        break;
    }

    if (is_weapon)
    {
        if (config.chams_enable[2])
        {
            *(CMaterial2**)((uintptr_t)data + 0x18) = visible_material;
            set_color(data, config.chams_color[2]);
            original(animtable_scene_object, dx11, data, unknown_bool, scene_view, scene_layer, unknown_pointer, unknown);
        }
    }

}
C++:
static void set_material_shader_type(void* data, const char* shader_name)
{
    using type = void(__fastcall*)(void*, keystring, const char*, int);

    type fn = (type)memory::set_material_shader_type; // particles.dll  E8 ? ? ? ? 48 8D B7 ? ? ? ? + 1

    keystring shader((const char*)"shader", 0x162C1777);
    fn(data, shader, shader_name, 0x18);
}

static void set_material_functions(void* data, const char* functions_name, int value)
{
    using type = void(__fastcall*)(void*, keystring, int, int);
    type set_other = (type)memory::set_material_functions; //particles.dll  E8 ? ? ? ? 49 C1 E5 21 + 1

    keystring functions(functions_name, true);

    set_other(data, functions, value, 0x12);
}

static CMaterial2* create_material_visible()
{
    CMaterialSystem2* material_system = /*VMaterialSystem2_001*/

    byte* buffer[0x200] = {};
    void* data = buffer + 0x50; // cringe

    CMaterial2** material_prototype;

    material_system->find_material(&material_prototype, "materials/dev/primary_white.vmat");

    material_system->set_create_data_by_material(data, &material_prototype);

    set_material_shader_type(data, "csgo_unlitgeneric.vfx");

    set_material_functions(data, "F_BLEND_MODE", 1);

    set_material_functions(data, "F_TRANSLUCENT", true);

    CMaterial2** custom_material;

    material_system->create_material(&custom_material, "visible_material", data);

    return *custom_material;
}

static CMaterial2* create_material_invisible()
{
    CMaterialSystem2* material_system = /*VMaterialSystem2_001*/

    byte* buffer[0x200] = {};
    void* data = buffer + 0x50; // cringe
 
    CMaterial2** material_prototype;

    material_system->find_material(&material_prototype, "materials/dev/primary_white.vmat");

    material_system->set_create_data_by_material(data, &material_prototype);

    set_material_shader_type(data, "csgo_unlitgeneric.vfx");

    set_material_functions(data, "F_DISABLE_Z_BUFFERING", true);

    set_material_functions(data, "F_BLEND_MODE", 1);

    set_material_functions(data, "F_TRANSLUCENT", true);

    CMaterial2** custom_material;

    material_system->create_material(&custom_material, "invisible_material", data);

    return *custom_material;
}
C++:
class CMaterial2 {
public:
    const char* get_name() {
        return CALL_VIRTUAL(const char*, 0, this);
    }

    const char* get_share_name() {
        return CALL_VIRTUAL(const char*, 1, this);
    }
};

class CMaterialSystem2 {
public:
    CMaterial2*** find_material(CMaterial2*** material, const char* material_name) {
        return CALL_VIRTUAL(CMaterial2***, 14, this, material, material_name);
    }

    CMaterial2** create_material(CMaterial2*** empty_material, const char* new_material_name, void* material_data)
    {
        return CALL_VIRTUAL(CMaterial2**, 29, this, empty_material, new_material_name, material_data, 0, 0, 0, 0, 0, 1);
    }

    void set_create_data_by_material(void* data, CMaterial2*** material)
    {
        return CALL_VIRTUAL(void, 37, this, material, data);
    }
};
C++:
class keystring {
public:
    uintptr_t m_key;
    const char* m_string;

    keystring(const char* string, bool finding_key = false) {
        m_string = string;
        m_key = finding_key ? find_key(string) : -1;
    }

    keystring(const char* string, int key) {
        m_string = string;
        m_key = key;
    }

    uintptr_t find_key(const char* name) {
        using type = uintptr_t(__fastcall*)(const char*, int, int);
        type fn = (type)memory::find_var_material; // particles.dll E8 ? ? ? ? 80 7F 1A 00 + 1
        return fn(name, 0x12, 0x31415926);
    }

};

static void set_color(void* data, float* color)
{
    *(byte*)((uintptr_t)data + 0x40) = color[0] * 255;
    *(byte*)((uintptr_t)data + 0x41) = color[1] * 255;
    *(byte*)((uintptr_t)data + 0x42) = color[2] * 255;
    *(byte*)((uintptr_t)data + 0x43) = color[3] * 255;
}
1695109517814.png
 
Сверху Снизу