- Статус
- Оффлайн
- Регистрация
- 27 Янв 2021
- Сообщения
- 1,242
- Реакции
- 219
Вот код
code_language.lua:
ffi.cdef [[
typedef struct {
float x;
float y;
float z;
}vec3_t;
typedef struct
{
void* fnHandle; //0x0000
char szName[260]; //0x0004
int nLoadFlags; //0x0108
int nServerCount; //0x010C
int type; //0x0110
int flags; //0x0114
vec3_t vecMins; //0x0118
vec3_t vecMaxs; //0x0124
float radius; //0x0130
char pad[0x1C]; //0x0134
}model_t;//Size=0x0150
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* find_table_t)(void*, const char*);
typedef void(__thiscall* set_model_index_t)(void*, int);
typedef int(__thiscall* precache_model_t)(void*, const char*, bool);
]]
local class_ptr = ffi.typeof("void***")
local rawivmodelinfo = utils.create_interface("engine.dll", "VModelInfoClient004") or error("VModelInfoClient004 wasnt found", 2)
local ivmodelinfo = ffi.cast(class_ptr, rawivmodelinfo) or error("rawivmodelinfo is nil", 2)
local get_model_index = ffi.cast("get_model_index_t", ivmodelinfo[0][2]) or error("get_model_info is nil", 2)
events.net_update_end:set(function()
local local_player = entity.get_local_player()
if local_player == nil then return end
local model_idx = get_model_index(ivmodelinfo, "models/player/custom_player/toppiofficial/genshin/rework/hutao.mdl")
if model_idx ~= -1 then
local_player["m_nModelIndex"] = model_idx
end
end)