• MONEY за подписку! Ничего делать не надо совсем, всего-то подписаться на тг одмена и нажать кнопку "Принять участие" в розыгрыше: https://t.me/govthing/7650

Вопрос [GS] как пофиксить музик кит ченджер

servermapper expert
Пользователь
Пользователь
Статус
Оффлайн
Регистрация
15 Фев 2020
Сообщения
279
Реакции
60
накатал музик кит ченджер но музыка ставится рандомным людям, скорее всего потому что я получаю не свой CCSPlayerResource. как чинить это?
lua:
Expand Collapse Copy
local kit_list = {
    "No music kit",
    "CS:GO",
    "musickit_valve_csgo_02",
    "Crimson Assault",
    "Sharpened",
    "Insurgency",
    "AD8",
    "High Noon",
    "Death's Head Demolition",
    "Desert Fire",
    "LNOE",
    "Metal",
    "All I Want for Christmas",
    "IsoRhythm",
    "For No Mankind",
    "Hotline Miami",
    "Total Domination",
    "The Talos Principle",
    "Battlepack",
    "MOLOTOV",
    "Uber Blasto Phone",
    "Hazardous Environments",
    "Headshot",
    "The 8-Bit Kit",
    "I Am",
    "Diamonds",
    "Invasion!",
    "Lion's Mouth",
    "Sponge Fingerz",
    "Disgusting",
    "Java Havana Funkaloo",
    "Moments CSGO",
    "Aggressive",
    "The Good Youth",
    "FREE",
    "Life's Not Out To Get You",
    "Backbone",
    "GLA",
    "III-Arena",
    "EZ4ENCE",
    "The Master Chief Collection",
    "Scar",
    "Anti Citizen",
    "Bachram",
    "Gunman Taco Truck",
    "Eye of the Dragon",
    "M.U.D.D. FORCE",
    "Neo Noir",
    "Bodacious",
    "Drifter",
    "All for Dust",
    "Hades Music Kit",
    "The Lowlife Pack",
    "CHAIN$AW.LXADXUT.",
    "Mocha Petal",
    "~Yellow Magic~",
    "Vici",
    "Astro Bellum",
    "Work Hard, Play Hard",
    "KOLIBRI",
    "u mad!",
    "Flashbang Dance",
    "Heading for the Source",
    "Void",
    "Shooters",
    "dashstar*",
    "Gothic Luxury",
    "Lock Me Up",
    "花脸 Hua Lian (Painted Face)",
    "ULTIMATE"
}

local function indexOf(array, value)
    for i, v in ipairs(array) do
        if v == value then
            return i
        end
    end
    return nil
end

local listbox = ui.new_combobox("skins", 'Model options', 'Music kit', kit_list)

local function set_music_kit(idx)
    local local_index = entity.get_local_player()
    if local_index == nil then
        return
    end

    entity.set_prop(entity.get_player_resource(), 'm_nMusicID', idx, 1)
end

ui.set_callback(listbox, function()
    set_music_kit(indexOf(kit_list, ui.get(listbox)) - 1)
end)

client.set_event_callback('round_start', function()
    set_music_kit(indexOf(kit_list, ui.get(listbox)) - 1)
end)

client.set_event_callback('shutdown', function()
    set_music_kit(0)
end)
 
  • Мне нравится
Реакции: mj12
1736021370951.png


code_language.lua:
Expand Collapse Copy
local kit_list = {
    "No music kit",
    "CS:GO",
    "musickit_valve_csgo_02",
    "Crimson Assault",
    "Sharpened",
    "Insurgency",
    "AD8",
    "High Noon",
    "Death's Head Demolition",
    "Desert Fire",
    "LNOE",
    "Metal",
    "All I Want for Christmas",
    "IsoRhythm",
    "For No Mankind",
    "Hotline Miami",
    "Total Domination",
    "The Talos Principle",
    "Battlepack",
    "MOLOTOV",
    "Uber Blasto Phone",
    "Hazardous Environments",
    "Headshot",
    "The 8-Bit Kit",
    "I Am",
    "Diamonds",
    "Invasion!",
    "Lion's Mouth",
    "Sponge Fingerz",
    "Disgusting",
    "Java Havana Funkaloo",
    "Moments CSGO",
    "Aggressive",
    "The Good Youth",
    "FREE",
    "Life's Not Out To Get You",
    "Backbone",
    "GLA",
    "III-Arena",
    "EZ4ENCE",
    "The Master Chief Collection",
    "Scar",
    "Anti Citizen",
    "Bachram",
    "Gunman Taco Truck",
    "Eye of the Dragon",
    "M.U.D.D. FORCE",
    "Neo Noir",
    "Bodacious",
    "Drifter",
    "All for Dust",
    "Hades Music Kit",
    "The Lowlife Pack",
    "CHAIN$AW.LXADXUT.",
    "Mocha Petal",
    "~Yellow Magic~",
    "Vici",
    "Astro Bellum",
    "Work Hard, Play Hard",
    "KOLIBRI",
    "u mad!",
    "Flashbang Dance",
    "Heading for the Source",
    "Void",
    "Shooters",
    "dashstar*",
    "Gothic Luxury",
    "Lock Me Up",
    "花脸 Hua Lian (Painted Face)",
    "ULTIMATE"
}

local function indexOf(array, value)
    for i, v in ipairs(array) do
        if v == value then
            return i
        end
    end
    return nil
end

local listbox = ui.new_combobox("skins", 'Model options', 'Music kit', kit_list)

local function set_music_kit(idx)
    local local_player = entity.get_local_player()
    if not local_player then
        return
    end

    local player_resource = entity.get_player_resource()
    if not player_resource then
        return
    end

    entity.set_prop(player_resource, 'm_nMusicID', idx, local_player)
end


ui.set_callback(listbox, function()
    set_music_kit(indexOf(kit_list, ui.get(listbox)) - 1)
end)

client.set_event_callback('round_start', function()
    set_music_kit(indexOf(kit_list, ui.get(listbox)) - 1)
end)

client.set_event_callback('shutdown', function()
    set_music_kit(0)
end)
 
Назад
Сверху Снизу