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

ппоршень
Пользователь
Статус
Оффлайн
Регистрация
15 Фев 2020
Сообщения
298
Реакции[?]
52
Поинты[?]
41K
накатал музик кит ченджер но музыка ставится рандомным людям, скорее всего потому что я получаю не свой CCSPlayerResource. как чинить это?
lua:
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)
 
Модератор раздела "Создание скриптов для читов"
Модератор
Статус
Оффлайн
Регистрация
1 Фев 2020
Сообщения
1,247
Реакции[?]
424
Поинты[?]
65K
1736021370951.png

code_language.lua:
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)
 
Сверху Снизу