Вопрос [PDC] Помощь с ошибкой в model changer

Synapse Softworks
Пользователь
Статус
Онлайн
Регистрация
3 Май 2020
Сообщения
335
Реакции[?]
33
Поинты[?]
2K
вообщем я скачал отсюда https://yougame.biz/threads/281405/ (noad) модел чейнджер и захотел добавить своих моделек

но после того как я добавил вылезает ошибка
1684605518935.png
мб кто то подскажет что делать
вот сам код
code_language.lua:
local ffi = require("ffi")
local path = {
    "models/player/custom_player/legacy/tm_jungle_raider_variantf.mdl", -- Trapper Aggressor | Guerrilla Warfare
    "models/player/custom_player/legacy/tm_leet_variantj.mdl", -- Mr. Muhlik | Elite Crew
    "models/player/custom_player/legacy/tm_phoenix_variantf.mdl", -- Enforcer | Phoenix
    "models/player/custom_player/legacy/tm_phoenix_varianth.mdl", -- Soldier | Phoenix
    "models/player/custom_player/legacy/tm_leet_variantg.mdl", -- Ground Rebel | Elite Crew
    "models/player/custom_player/legacy/tm_phoenix_varianti.mdl", -- Street Soldier | Phoenix
    "models/player/custom_player/legacy/tm_balkan_variantl.mdl", -- Dragomir | Sabre Footsoldier
    "models/player/custom_player/legacy/tm_jungle_raider_variantd.mdl", -- Col. Mangos Dabisi | Guerrilla Warfare
    "models/player/custom_player/legacy/tm_jungle_raider_variantf2.mdl", -- Trapper | Guerrilla Warfare
    "models/player/custom_player/legacy/tm_balkan_varianti.mdl", -- Maximus | Sabre
    "models/player/custom_player/legacy/tm_leet_varianth.mdl", -- Osiris | Elite Crew
    "models/player/custom_player/legacy/tm_phoenix_variantg.mdl", -- Slingshot | Phoenix
    "models/player/custom_player/legacy/tm_balkan_variantf.mdl", -- Dragomir | Sabre
    "models/player/custom_player/legacy/tm_professional_varj.mdl", -- Getaway Sally | The Professionals
    "models/player/custom_player/legacy/tm_professional_varh.mdl", -- Little Kev | The Professionals
    "models/player/custom_player/legacy/tm_professional_varf5.mdl", -- Bloody Darryl The Strapped | The Professionals
    "models/player/custom_player/legacy/tm_jungle_raider_varianta.mdl", -- Elite Trapper Solman | Guerrilla Warfare
    "models/player/custom_player/legacy/tm_jungle_raider_variantc.mdl", -- Arno The Overgrown | Guerrilla Warfare
    "models/player/custom_player/legacy/tm_balkan_variantj.mdl", -- Blackwolf | Sabre
    "models/player/custom_player/legacy/tm_leet_varianti.mdl", -- Prof. Shahmat | Elite Crew
    "models/player/custom_player/legacy/tm_balkan_variantg.mdl", -- Rezan The Ready | Sabre
    "models/player/custom_player/legacy/tm_professional_vari.mdl", -- Number K | The Professionals
    "models/player/custom_player/legacy/tm_professional_varg.mdl", -- Safecracker Voltzmann | The Professionals
    "models/player/custom_player/legacy/tm_balkan_variantk.mdl", -- Rezan the Redshirt | Sabre
    "models/player/custom_player/legacy/tm_jungle_raider_variante.mdl", -- Vypa Sista of the Revolution | Guerrilla Warfare
    "models/player/custom_player/legacy/tm_jungle_raider_variantb2.mdl", -- 'Medium Rare' Crasswater | Guerrilla Warfare
    "models/player/custom_player/legacy/tm_jungle_raider_variantb.mdl", -- Crasswater The Forgotten | Guerrilla Warfare
    "models/player/custom_player/legacy/tm_balkan_varianth.mdl", -- 'The Doctor' Romanov | Sabre
    "models/player/custom_player/legacy/tm_leet_variantf.mdl", -- The Elite Mr. Muhlik | Elite Crew
    "models/player/custom_player/legacy/tm_professional_varf.mdl", -- Sir Bloody Miami Darryl | The Professionals
    "models/player/custom_player/legacy/tm_professional_varf1.mdl", -- Sir Bloody Silent Darryl | The Professionals
    "models/player/custom_player/legacy/tm_professional_varf2.mdl", -- Sir Bloody Skullhead Darryl | The Professionals
    "models/player/custom_player/legacy/tm_professional_varf3.mdl", -- Sir Bloody Darryl Royale | The Professionals
    "models/player/custom_player/legacy/tm_professional_varf4.mdl", -- Sir Bloody Loudmouth Darryl | The Professionals

    -- CT

    "models/player/custom_player/legacy/ctm_st6_variantn.mdl", -- Primeiro Tenente | Brazilian 1st Battalion
    "models/player/custom_player/legacy/ctm_sas_variantg.mdl", -- D Squadron Officer | NZSAS
    "models/player/custom_player/legacy/ctm_gendarmerie_variantd.mdl", -- Aspirant | Gendarmerie Nationale
    "models/player/custom_player/legacy/ctm_st6_variante.mdl", -- Seal Team 6 Soldier | NSWC SEAL
    "models/player/custom_player/legacy/ctm_st6_variantk.mdl", -- 3rd Commando Company | KSK
    "models/player/custom_player/legacy/ctm_fbi_variantf.mdl", -- Operator | FBI SWAT
    "models/player/custom_player/legacy/ctm_sas_variantf.mdl", -- B Squadron Officer | SAS
    "models/player/custom_player/legacy/ctm_swat_variantj.mdl", -- Chem-Haz Specialist | SWAT
    "models/player/custom_player/legacy/ctm_swat_varianth.mdl", -- Bio-Haz Specialist | SWAT
    "models/player/custom_player/legacy/ctm_gendarmerie_variante.mdl", -- Officer Jacques Beltram | Gendarmerie Nationale
    "models/player/custom_player/legacy/ctm_swat_variantk.mdl", -- Lieutenant 'Tree Hugger' Farlow | SWAT
    "models/player/custom_player/legacy/ctm_gendarmerie_varianta.mdl", -- Sous-Lieutenant Medic | Gendarmerie Nationale
    "models/player/custom_player/legacy/ctm_fbi_variantg.mdl", -- Markus Delrow | FBI
    "models/player/custom_player/legacy/ctm_st6_variantg.mdl", -- Buckshot | NSWC SEAL
    "models/player/custom_player/legacy/ctm_swat_variantg.mdl", -- John 'Van Healen' Kask | SWAT
    "models/player/custom_player/legacy/ctm_swat_varianti.mdl", -- Sergeant Bombson | SWAT
    "models/player/custom_player/legacy/ctm_st6_variantj.mdl", -- 'Blueberries' Buckshot | NSWC SEAL
    "models/player/custom_player/legacy/ctm_gendarmerie_variantb.mdl", -- Chem-Haz Capitaine | Gendarmerie Nationale
    "models/player/custom_player/legacy/ctm_diver_variantc.mdl", -- Lieutenant Rex Krikey | SEAL Frogman
    "models/player/custom_player/legacy/ctm_fbi_varianth.mdl", -- Michael Syfers | FBI Sniper
    "models/player/custom_player/legacy/ctm_st6_variantm.mdl", -- Two Times' McCoy | USAF TACP
    "models/player/custom_player/legacy/ctm_swat_variantf.mdl", -- 1st Lieutenant Farlow | SWAT
    "models/player/custom_player/legacy/ctm_st6_variantl.mdl", -- 'Two Times' McCoy | TACP Cavalry
    "models/player/custom_player/legacy/ctm_gendarmerie_variantc.mdl", -- Chef d'Escadron Rouchard | Gendarmerie Nationale
    "models/player/custom_player/legacy/ctm_diver_variantb.mdl", -- Cmdr. Frank 'Wet Sox' Baroud | SEAL Frogman
    "models/player/custom_player/legacy/ctm_diver_varianta.mdl", -- Cmdr. Davida 'Goggles' Fernandez | SEAL Frogman
    "models/player/custom_player/legacy/ctm_st6_varianti.mdl", -- Lt. Commander Ricksaw | NSWC SEAL
    "models/player/custom_player/legacy/ctm_fbi_variantb.mdl", -- Special Agent Ava | FBI
    "models/player/custom_player/legacy/ctm_swat_variante.mdl", -- Cmdr. Mae 'Dead Cold' Jamison | SWAT
    "models/player/custom_player/kaesar/ghostface/ghostface.mdl", -- ghostface
    "models/player/wcsnik/animals/pig/pig_v2.mdl", -- Pig
}

local names = {
    "Trapper Aggressor | Guerrilla Warfare",
    "Mr. Muhlik | Elite Crew",
    "Enforcer | Phoenix",
    "Soldier | Phoenix",
    "Ground Rebel | Elite Crew",
    "Street Soldier | Phoenix",
    "Dragomir | Sabre Footsoldier",
    "Col. Mangos Dabisi | Guerrilla Warfare",
    "Trapper | Guerrilla Warfare",
    "Maximus | Sabre",
    "Osiris | Elite Crew",
    "Slingshot | Phoenix",
    "Dragomir | Sabre",
    "Getaway Sally | The Professionals",
    "Little Kev | The Professionals",
    "Bloody Darryl The Strapped | The Professionals",
    "Elite Trapper Solman | Guerrilla Warfare",
    "Arno The Overgrown | Guerrilla Warfare",
    "Blackwolf | Sabre",
    "Prof. Shahmat | Elite Crew",
    "Rezan The Ready | Sabre",
    "Number K | The Professionals",
    "Safecracker Voltzmann | The Professionals",
    "Rezan the Redshirt | Sabre",
    "Vypa Sista of the Revolution | Guerrilla Warfare",
    "'Medium Rare' Crasswater | Guerrilla Warfare",
    "Crasswater The Forgotten | Guerrilla Warfare",
    "'The Doctor' Romanov | Sabre",
    "The Elite Mr. Muhlik | Elite Crew",
    "Sir Bloody Miami Darryl | The Professionals",
    "Sir Bloody Silent Darryl | The Professionals",
    "Sir Bloody Skullhead Darryl | The Professionals",
    "Sir Bloody Darryl Royale | The Professionals",
    "Sir Bloody Loudmouth Darryl | The Professionals",
    "Primeiro Tenente | Brazilian 1st Battalion",
    "D Squadron Officer | NZSAS",
    "Aspirant | Gendarmerie Nationale",
    "Seal Team 6 Soldier | NSWC SEAL",
    "3rd Commando Company | KSK",
    "Operator | FBI SWAT",
    "B Squadron Officer | SAS",
    "Chem-Haz Specialist | SWAT",
    "Bio-Haz Specialist | SWAT",
    "Officer Jacques Beltram | Gendarmerie Nationale",
    "Lieutenant 'Tree Hugger' Farlow | SWAT",
    "Sous-Lieutenant Medic | Gendarmerie Nationale",
    "Markus Delrow | FBI",
    "Buckshot | NSWC SEAL",
    "John 'Van Healen' Kask | SWAT",
    "Sergeant Bombson | SWAT",
    "'Blueberries' Buckshot | NSWC SEAL",
    "Chem-Haz Capitaine | Gendarmerie Nationale",
    "Lieutenant Rex Krikey | SEAL Frogman",
    "Michael Syfers | FBI Sniper",
    "'Two Times' McCoy | USAF TACP ",
    "1st Lieutenant Farlow | SWAT",
    "'Two Times' McCoy | TACP Cavalry",
    "Chef d'Escadron Rouchard | Gendarmerie Nationale",
    "Cmdr. Frank 'Wet Sox' Baroud | SEAL Frogman",
    "Cmdr. Davida 'Goggles' Fernandez | SEAL Frogman",
    "Lt. Commander Ricksaw | NSWC SEAL",
    "Special Agent Ava | FBI",
    "Cmdr. Mae 'Dead Cold' Jamison | SWAT",
    "Jason",
    "Pig",
}

local menu = {
    switch = ui.add_checkbox("Enable Models"),
    ct = ui.add_dropdown("Agent CT", names),
    t = ui.add_dropdown("Agent T", names)
}

menu.handler = function()
    local switch = menu.switch:get()
    menu.ct:set_visible( switch )
    menu.t:set_visible( switch )
end

local TEAM_TERRORIST = 2;
local TEAM_CT = 3;

local function get_player_team( player )
    local m_iTeamNum = player:get_prop( "DT_BaseEntity", "m_iTeamNum" );

    return m_iTeamNum:get_int( );
end

ffi.cdef[[
    typedef struct
{
     void*   handle;
     char    name[260];
     int     load_flags;
     int     server_count;
     int     type;
     int     flags;
     float   mins[3];
     float   maxs[3];
     float   radius;
     char    pad[0x1C];
} model_t;
typedef struct _class{void** this;}aclass;
typedef void*(__thiscall* get_client_entity_t)(void*, int);
typedef void(__thiscall* find_or_load_model_fn_t)(void*, const char*);
typedef const int(__thiscall* get_model_index_fn_t)(void*, const char*);
typedef const int(__thiscall* add_string_fn_t)(void*, bool, const char*, int, const void*);
typedef void*(__thiscall* find_table_t)(void*, const char*);
typedef void(__thiscall* full_update_t)();
typedef int(__thiscall* get_player_idx_t)();
typedef void*(__thiscall* get_client_networkable_t)(void*, int);
typedef void(__thiscall* pre_data_update_t)(void*, int);
typedef int(__thiscall* get_model_index_t)(void*, const char*);
typedef const model_t(__thiscall* find_or_load_model_t)(void*, const char*);
typedef int(__thiscall* add_string_t)(void*, bool, const char*, int, const void*);
typedef void(__thiscall* set_model_index_t)(void*, int);
typedef int(__thiscall* precache_model_t)(void*, const char*, bool);
]]

local a = ffi.cast(ffi.typeof("void***"), client.create_interface("client.dll", "VClientEntityList003")) or error("rawientitylist is nil", 2)
local b = ffi.cast("get_client_entity_t", a[0][3]) or error("get_client_entity is nil", 2)
local c = ffi.cast(ffi.typeof("void***"), client.create_interface("engine.dll", "VModelInfoClient004")) or error("model info is nil", 2)
local d = ffi.cast("get_model_index_fn_t", c[0][2]) or error("Getmodelindex is nil", 2)
local e = ffi.cast("find_or_load_model_fn_t", c[0][43]) or error("findmodel is nil", 2)
local f = ffi.cast(ffi.typeof("void***"), client.create_interface("engine.dll","VEngineClientStringTable001")) or error("clientstring is nil", 2)
local g = ffi.cast("find_table_t", f[0][3]) or error("find table is nil", 2)

function p(pa)
    local a_p = ffi.cast(ffi.typeof("void***"), g(f, "modelprecache"))
    if a_p~= nil then
        e(c, pa)
        local ac = ffi.cast("add_string_fn_t", a_p[0][8]) or error("ac nil", 2)
        local acs = ac(a_p, false, pa, -1, nil)
        if acs == -1 then print("failed")
            return false
        end
    end
    return true
end

function smi(en, i)
    local rw = b(a, en)
    if rw then
        local gc = ffi.cast(ffi.typeof("void***"), rw)
        local se = ffi.cast("set_model_index_t", gc[0][75])
        if se == nil then
            error("smi is nil")
        end
        se(gc, i)
    end
end

function cm(ent, md)
    if md:len() > 5 then
        if p(md) == false then
            error("invalid model", 2)
        end
        local i = d(c, md)
        if i == -1 then
            return
        end
        smi(ent, i)
    end
end

function cmd1(stage)
    if stage ~= 1 then
        return
    end
    local ip = entity_list.get_client_entity( engine.get_local_player( ))
    local teamnum = get_player_team(ip)
    local is_t
    if teamnum == 2 then
        is_t = true
    elseif teamnum == 3 then
        is_t = false
    end
    if menu.switch:get() then

        if ip == nil then
            return
        end

        if engine.is_connected() and client.is_alive() then
            if is_t then
                cm(ip:index(), path[menu.t:get() + 1]) 
            else
                cm(ip:index(), path[menu.ct:get() + 1]) 
            end     
        end
    end 
end

function init()
    callbacks.register("paint", menu.handler);
    callbacks.register("pre_frame_stage", cmd1);
end; init()
вот сами модельки
Пожалуйста, авторизуйтесь для просмотра ссылки.
(noad)
Пожалуйста, авторизуйтесь для просмотра ссылки.
(noad)

upd: с моделькой свиньи вроде как разобрался
1684606111083.png
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
28 Апр 2023
Сообщения
144
Реакции[?]
25
Поинты[?]
1K
Что у тебя выводит
path[menu.t:get() + 1]
и
path[menu.ct:get() + 1]

Еще у тебя путь к свинье неправильный
 
Synapse Softworks
Пользователь
Статус
Онлайн
Регистрация
3 Май 2020
Сообщения
335
Реакции[?]
33
Поинты[?]
2K
Начинающий
Статус
Оффлайн
Регистрация
28 Апр 2023
Сообщения
144
Реакции[?]
25
Поинты[?]
1K
Synapse Softworks
Пользователь
Статус
Онлайн
Регистрация
3 Май 2020
Сообщения
335
Реакции[?]
33
Поинты[?]
2K
Начинающий
Статус
Оффлайн
Регистрация
28 Апр 2023
Сообщения
144
Реакции[?]
25
Поинты[?]
1K
Начинающий
Статус
Оффлайн
Регистрация
28 Апр 2023
Сообщения
144
Реакции[?]
25
Поинты[?]
1K
вообще не грузит
просто тень и моделька невидимая или что-то другое? Скажи подробно. Если то, что я щас сказал. То ты вероятно путь к модели неправильный указал, ибо у тебя прекэш моделей встроен в скрипт
 
Synapse Softworks
Пользователь
Статус
Онлайн
Регистрация
3 Май 2020
Сообщения
335
Реакции[?]
33
Поинты[?]
2K
просто тень и моделька невидимая или что-то другое? Скажи подробно. Если то, что я щас сказал. То ты вероятно путь к модели неправильный указал, ибо у тебя прекэш моделей встроен в скрипт
Нету тени никакой и там кароч еррор куб вылазит, потом дальше просто невидимой стает
 
Сверху Снизу