Загрузка данных


-- Ультра-безопасное создание меню для старых версий Скита в CS:GO
-- Используем только базовые вкладки MISC и Settings
local main_switch = ui.new_checkbox("MISC", "Settings", "Enable")

-- Элементы для Смены Моделей
local model_switch = ui.new_checkbox("MISC", "Settings", "Models")
local model_side = ui.new_combobox("MISC", "Settings", "Agent", {"Darryl", "NumberK", "Ava"})

-- Элементы для Звуков Попадания
local hit_switch = ui.new_checkbox("MISC", "Settings", "Sounds")
local hit_sound_type = ui.new_combobox("MISC", "Settings", "Type", {"Skeet", "Neverlose", "Bell", "Metal"})

-- Пути к оригинальным MDL файлам в CS:GO
local models_list = {
    ["Darryl"] = "models/player/custom_player/legacy/tm_professional_varf.mdl",
    ["NumberK"] = "models/player/custom_player/legacy/tm_professional_varg.mdl",
    ["Ava"] = "models/player/custom_player/legacy/ctm_fbi_variantb.mdl"
}

-- Безопасный прекэш моделей
client.set_event_callback("level_init", function()
    for _, path in pairs(models_list) do
        client.get_model_index(path)
    end
end)

-- Логика Хитсаунда
client.set_event_callback("player_hurt", function(event)
    if not ui.get(main_switch) or not ui.get(hit_switch) then return end

    local attacker = client.userid_to_entindex(event.attacker)
    local local_player = entity.get_local_player()
    
    if attacker == local_player then
        local sound = ui.get(hit_sound_type)
        if sound == "Skeet" then
            client.delay_sound(0, "buttons/arena_switch_press_02.wav")
        elseif sound == "Neverlose" then
            client.delay_sound(0, "physics/metal/paintcan_impact_hard3.wav")
        elseif sound == "Bell" then
            client.delay_sound(0, "training/bell_impact.wav")
        elseif sound == "Metal" then
            client.delay_sound(0, "physics/metal/metal_solid_impact_bullet2.wav")
        end
    end
end)

-- Логика Модель Чейнджера
client.set_event_callback("net_update_end", function()
    if not ui.get(main_switch) or not ui.get(model_switch) then return end

    local local_player = entity.get_local_player()
    if not local_player or not entity.is_alive(local_player) then return end

    local chosen_name = ui.get(model_side)
    local model_path = models_list[chosen_name]
    
    if model_path then
        local m_index = client.get_model_index(model_path)
        if m_index and m_index ~= -1 then
            entity.set_prop(local_player, "m_nModelIndex", m_index)
        end
    end
end)

client.log("[Skeet] All functions are ready!")