Вопросы по Lua скриптингу

Общая тема для вопросов по разработке скриптов на языке программирования Lua, в частности под MoonLoader.
  • Задавая вопрос, убедитесь, что его нет в списке частых вопросов и что на него ещё не отвечали (воспользуйтесь поиском).
  • Поищите ответ в теме посвященной разработке Lua скриптов в MoonLoader
  • Отвечая, убедитесь, что ваш ответ корректен.
  • Старайтесь как можно точнее выразить мысль, а если проблема связана с кодом, то обязательно прикрепите его к сообщению, используя блок [code=lua]здесь мог бы быть ваш код[/code].
  • Если вопрос связан с MoonLoader-ом первым делом желательно поискать решение на wiki.

Частые вопросы

Как научиться писать скрипты? С чего начать?
Информация - Гайд - Всё о Lua скриптинге для MoonLoader(https://blast.hk/threads/22707/)
Как вывести текст на русском? Вместо русского текста у меня какие-то каракули.
Изменить кодировку файла скрипта на Windows-1251. В Atom: комбинация клавиш Ctrl+Shift+U, в Notepad++: меню Кодировки -> Кодировки -> Кириллица -> Windows-1251.
Как получить транспорт, в котором сидит игрок?
Lua:
local veh = storeCarCharIsInNoSave(PLAYER_PED)
Как получить свой id или id другого игрока?
Lua:
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED) -- получить свой ид
local _, id = sampGetPlayerIdByCharHandle(ped) -- получить ид другого игрока. ped - это хендл персонажа
Как проверить, что строка содержит какой-то текст?
Lua:
if string.find(str, 'текст', 1, true) then
-- строка str содержит "текст"
end
Как эмулировать нажатие игровой клавиши?
Lua:
local game_keys = require 'game.keys' -- где-нибудь в начале скрипта вне функции main

setGameKeyState(game_keys.player.FIREWEAPON, -1) -- будет сэмулировано нажатие клавиши атаки
Все иды клавиш находятся в файле moonloader/lib/game/keys.lua.
Подробнее о функции setGameKeyState здесь: lua - setgamekeystate | BlastHack — DEV_WIKI(https://www.blast.hk/wiki/lua:setgamekeystate)
Как получить id другого игрока, в которого целюсь я?
Lua:
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) -- получить хендл персонажа, в которого целится игрок
if valid and doesCharExist(ped) then -- если цель есть и персонаж существует
  local result, id = sampGetPlayerIdByCharHandle(ped) -- получить samp-ид игрока по хендлу персонажа
  if result then -- проверить, прошло ли получение ида успешно
    -- здесь любые действия с полученным идом игрока
  end
end
Как зарегистрировать команду чата SAMP?
Lua:
-- До бесконечного цикла/задержки
sampRegisterChatCommand("mycommand", function (param)
     -- param будет содержать весь текст введенный после команды, чтобы разделить его на аргументы используйте string.match()
    sampAddChatMessage("MyCMD", -1)
end)
Крашит игру при вызове sampSendChat. Как это исправить?
Это происходит из-за бага в SAMPFUNCS, когда производится попытка отправки пакета определенными функциями изнутри события исходящих RPC и пакетов. Исправления для этого бага нет, но есть способ не провоцировать его. Вызов sampSendChat изнутри обработчика исходящих RPC/пакетов нужно обернуть в скриптовый поток с нулевой задержкой:
Lua:
function onSendRpc(id)
  -- крашит:
  -- sampSendChat('Send RPC: ' .. id)

  -- норм:
  lua_thread.create(function()
    wait(0)
    sampSendChat('Send RPC: ' .. id)
  end)
end
 
Последнее редактирование:

KIBERSTALKER

Участник
30
2
Люди, помогите ) Сохраняю buffer в конфиг. Захожу в игру, начинаю писать buffer, а экран пропадает

Code:
script_name('CMI Helper')
script_author('Wilman')

require "lib.moonloader"

local tag = '[ CMI ] Namalsk - '
local imgui = require 'imgui'
local label = 0
local keys = require  'vkeys'
local inicfg = require 'inicfg'
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

-- Main's --

local main_menu = imgui.ImBool(false)
local main_two = imgui.ImBool(false)
local main_three = imgui.ImBool(false)
local main_four = imgui.ImBool(false)
local main_five = imgui.ImBool(false)
local main_six = imgui.ImBool(false)
local main_seven = imgui.ImBool(false)
local main_eight = imgui.ImBool(false)
local main_nine = imgui.ImBool(false)
local main_ten = imgui.ImBool(false)



-- Main's --

local inicfg = require 'inicfg'
local cfg = inicfg.load({
    Settings = {
        input = ""
    }
}, 'config')

local text_buffer = imgui.ImBuffer(u8(cfg.Settings.input), 10000)



local sw, sh = getScreenResolution()

function apply_custom_style()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    style.WindowRounding = 2.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
    style.ChildWindowRounding = 2.0
    style.FrameRounding = 2.0
    style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
    style.ScrollbarSize = 13.0
    style.ScrollbarRounding = 0
    style.GrabMinSize = 8.0
    style.GrabRounding = 1.0

    colors[clr.FrameBg]                = ImVec4(0.16, 0.48, 0.42, 100)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 100)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.48, 0.42, 100)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 100)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.88, 0.77, 100)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Button]                 = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.98, 0.82, 100)
    colors[clr.Header]                 = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.10, 0.75, 0.63, 100)
    colors[clr.SeparatorActive]        = ImVec4(0.10, 0.75, 0.63, 100)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 100)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.81, 0.35, 100)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 100)
    colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 100)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 100)
    colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 100)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 100)
    colors[clr.ComboBg]                = colors[clr.PopupBg]
    colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 100)
    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 100)
    colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 100)
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 100)
    colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 100)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 100)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 100)
    colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 100)
    colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 100)
    colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 100)
    colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 100)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 100)
    colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 100)
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
        while not isSampAvailable() do wait(100) end

        sampRegisterChatCommand("nh", function ()
            main_menu.v = not main_menu.v
            imgui.Process = main_menu.v
            imgui.ShowCursor = main_menu.v
        end)

        imgui.Process = false

        sampAddChatMessage(tag .. "{FFFFFF}А{5A90CE}ктивирован!", main_color)

        while true do
            wait(0)

            imgui.Process = main_menu.v or main_two.v or main_three.v or main_four.v or main_five.v or main_six.v or main_eight.v or main_nine.v or main_seven.v

            if main_menu.v or main_two.v or main_three.v or main_four.v or main_five.v or main_six.v or main_eight.v or main_nine.v or main_seven.v then
                    imgui.ShowCursor = true
            else
                    imgui.ShowCursor = false
            end
    end
end

function imgui.OnDrawFrame()

    if not main_menu.v and not main_two.v and not main_three.v and not main_four and not main_five.v and not main_six.v and not main_eight.v and not main_nine.v and not main_ten.v and not main_seven.v then
            imgui.Process = false
    end

    -- Main Menu --

    if main_menu.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'CMI Helper - Namalsk', main_menu, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Устав', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_two.v = not main_two.v
        end

        if imgui.Button(u8'Для Заместителей', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_four.v = not main_two.v
        end

        if imgui.Button(u8'П.Р.О', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_three.v = not main_three.v
        end

        imgui.End()
    end

    -- Main Two --

    if main_two.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(1100, 600), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Устав', main_two, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.InputTextMultiline(u8"", text_buffer, imgui.ImVec2(1300, 550)) then
            cfg.Settings.input = u8:decode(buffer.v)
            inicfg.save(cfg, 'config')
        end

        if imgui.Button(u8'Назад', imgui.ImVec2(1100,30)) then
            main_menu.v = not main_menu.v
            main_two.v = false
        end

        imgui.End()
    end

    -- Main Three --

    if main_three.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'П.Р.О', main_three, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
            main_menu.v = not main_menu.v
            main_three.v = false
        end

        imgui.End()
    end

    -- Main Four --

    if main_four.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Для Заместителей/Лидера', main_four, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Увольнение', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_five.v = not main_five.v
        end

        if imgui.Button(u8'Собеседование', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_six.v = not main_six.v
        end

        if imgui.Button(u8'Звание', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_eight.v = not main_six.v
        end

        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
            main_menu.v = not main_menu.v
            main_four.v = false
        end

        imgui.End()
    end


        -- Main Five --

    if main_five.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Увольнение сотрудника', main_five, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Увольнение По Собственному Желанию', imgui.ImVec2(800, 30)) then
            local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : СЖ", "/do Процесс."}
            lua_thread.create(function()
                for k, v in ipairs(arr) do
                    sampSendChat(v)
                    wait(2000)
                end
                sampSetChatInputEnabled(true)
                sampSetChatInputText('/uninvite  Проф.Непригоден (СЖ)')
            end)
        end

        if imgui.Button(u8'Увольнение По Нарушению Устава', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : Н.У", "/do Процесс."}
                lua_thread.create(function()
                        for k, v in ipairs(arr) do
                                sampSendChat(v)
                                wait(2000)
                        end
                        sampSetChatInputEnabled(true)
                        sampSetChatInputText('/uninvite  Проф.Непригоден (Н.У)')
                end)
        end

        if imgui.Button(u8'Увольнение По Прогулу Рабочего Дня', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : Прогул Раб.Дня", "/do Процесс."}
                lua_thread.create(function()
                        for k, v in ipairs(arr) do
                                sampSendChat(v)
                                wait(2000)
                        end
                        sampSetChatInputEnabled(true)
                        sampSetChatInputText('/uninvite  Проф.Непригоден (Прогул Раб.Дня)')
                end)
        end

        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
            main_four.v = not main_four.v
            main_five.v = false
        end

            imgui.End()
        end

        -- Main Six --

        if main_six.v then

            local sw, sh = getScreenResolution()
            imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
            imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

            imgui.Begin(u8'Собеседование', main_six, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

            if imgui.Button(u8'Поприветствовать', imgui.ImVec2(800, 30)) then
                local arr = {"Добрый день.", "Я так понял, вы на собеседование", "Прошу предъявить мне пакет с лицензией", "И паспортом"}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('Хорошо...')
                end)
            end

            if imgui.Button(u8'Документы', imgui.ImVec2(800, 30)) then
                    local arr = {"/me протянул руку за пакетом", "/do Процесс.", "/me легким движением руки взял пакет, затем достал паспорт и лицензии", "/do Паспорт и лицензии в руках.", "/me открыл их на нужно странице, затем закрыл", "/do Лицензии и паспорт закрыты.", "/me положил лицензии и паспорт обратно, затем вернул их", "/do Процесс."}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Хорошо...')
                    end)
            end

            if imgui.Button(u8'Психология', imgui.ImVec2(800, 30)) then
                    local arr = {"Сейчас будет психологический тест", "Сядьте", "/b Вставай, годен!", "/b Вставай, годен!", "Вставайте", "Вы молодец, прошли тест!"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Хорошо...')
                    end)
            end

            if imgui.Button(u8'Терминология', imgui.ImVec2(800, 30)) then
                    local arr = {"Пока я заполняю бланк, вы можете постоять", "/b ДМ, ТК, МГ в /b", "/me достал бланк с вопросами", "/me ввёл ответы кандидата", "/do Процесс.", "/me написал оценку под бланком, затем убрал его", "/do Процесс.", "/b ДМ, ТК, МГ в /b", "Хорошо..."}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Я думаю, вы нам подходите.')
                    end)
            end

            if imgui.Button(u8'Годен!', imgui.ImVec2(800, 30)) then
                    local arr = {"Я вас поздравляю! Вот возьмите жетон и форму.", "/me достал пакет из под стола, затем разрезал его ножом", "/do Процесс.", "/me положил одежду и жетон на стол", "/do Процесс.", "Вот берите.", "Счастливой работы!"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('/invite ')
                    end)
            end

            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                main_five.v = not main_five.v
                main_six.v = false
            end

                imgui.End()
            end

        -- Main Eight --

        if main_eight.v then

            local sw, sh = getScreenResolution()
            imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
            imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

            imgui.Begin(u8'Звание', main_eight, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

            if imgui.Button(u8'Выдать', imgui.ImVec2(800, 30)) then
                   local arr = {"Поздравляю! Ты повышен!", "/me достал жетон из правого кармана", "/do Жетон в руке.", "/me лёгким движением руки с гордостью передал его", "/do Процесс."}
                   lua_thread.create(function()
                       for k, v in ipairs(arr) do
                           sampSendChat(v)
                           wait(2000)
                       end
                       sampSetChatInputEnabled(true)
                       sampSetChatInputText('/setrank')
                    end)
            end

            if imgui.Button(u8'Забрать', imgui.ImVec2(800, 30)) then
                     local arr = {"Плохо! Отдавай свой жетон!", "/me забрал жетон у человека напротив, затем убрал его в карман", "/do Процесс.", "Можешь идти! Чтобы больше такого не повторялось"}
                     lua_thread.create(function()
                             for k, v in ipairs(arr) do
                                     sampSendChat(v)
                                     wait(2000)
                             end
                             sampSetChatInputEnabled(true)
                             sampSetChatInputText('/setrank')
                        end)
            end

            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                main_six.v = not main_six.v
                main_eight.v = false
            end

                imgui.End()
            end
end
 

Andrinall

Известный
679
532
Вопрос к вам люди. Как сделать чтобы сохранялись Buffer? Я уже и так и сяк, и менял переменные, в итоге они нифега не сохраняются. Либо сохраняются, но потом исчезают. Мне нужно 2 и больше Buffer. Помогите

Code:
script_name('CMI Helper')
script_author('Wilman')

require "lib.moonloader"

local tag = '[ CMI ] Namalsk - '
local imgui = require 'imgui'
local label = 0
local keys = require  'vkeys'
local inicfg = require 'inicfg'
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

-- Main's --

local main_menu = imgui.ImBool(false)
local main_two = imgui.ImBool(false)
local main_three = imgui.ImBool(false)
local main_four = imgui.ImBool(false)
local main_five = imgui.ImBool(false)
local main_six = imgui.ImBool(false)
local main_seven = imgui.ImBool(false)
local main_eight = imgui.ImBool(false)
local main_nine = imgui.ImBool(false)
local main_ten = imgui.ImBool(false)



-- Main's --

local inicfg = require 'inicfg'
local cfg = inicfg.load({
    Settings = {
        input = ""
    }
}, 'config')

local inicfg1 = require 'inicfg'
local cfg1 = inicfg1.load({
    Settings = {
        input = ""
    }
}, 'config1')

local text_buffer = imgui.ImBuffer(u8(cfg.Settings.input), 10000)
local buffer = imgui.ImBuffer(u8(cfg.Settings.input), 10000)



local sw, sh = getScreenResolution()

function apply_custom_style()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    style.WindowRounding = 2.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
    style.ChildWindowRounding = 2.0
    style.FrameRounding = 2.0
    style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
    style.ScrollbarSize = 13.0
    style.ScrollbarRounding = 0
    style.GrabMinSize = 8.0
    style.GrabRounding = 1.0

    colors[clr.FrameBg]                = ImVec4(0.16, 0.48, 0.42, 100)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 100)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.48, 0.42, 100)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 100)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.88, 0.77, 100)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Button]                 = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.98, 0.82, 100)
    colors[clr.Header]                 = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.10, 0.75, 0.63, 100)
    colors[clr.SeparatorActive]        = ImVec4(0.10, 0.75, 0.63, 100)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 100)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.81, 0.35, 100)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 100)
    colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 100)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 100)
    colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 100)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 100)
    colors[clr.ComboBg]                = colors[clr.PopupBg]
    colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 100)
    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 100)
    colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 100)
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 100)
    colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 100)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 100)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 100)
    colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 100)
    colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 100)
    colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 100)
    colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 100)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 100)
    colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 100)
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
        while not isSampAvailable() do wait(100) end

        sampRegisterChatCommand("nh", function ()
            main_menu.v = not main_menu.v
            imgui.Process = main_menu.v
            imgui.ShowCursor = main_menu.v
        end)

        imgui.Process = false

        sampAddChatMessage(tag .. "{FFFFFF}А{5A90CE}ктивирован!", main_color)

        while true do
            wait(0)

            imgui.Process = main_menu.v or main_two.v or main_three.v or main_four.v or main_five.v or main_six.v or main_eight.v or main_nine.v or main_seven.v

            if main_menu.v or main_two.v or main_three.v or main_four.v or main_five.v or main_six.v or main_eight.v or main_nine.v or main_seven.v then
                    imgui.ShowCursor = true
            else
                    imgui.ShowCursor = false
            end
    end
end

function imgui.OnDrawFrame()

    if not main_menu.v and not main_two.v and not main_three.v and not main_four and not main_five.v and not main_six.v and not main_eight.v and not main_nine.v and not main_ten.v and not main_seven.v then
            imgui.Process = false
    end

    -- Main Menu --

    if main_menu.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'CMI Helper - Namalsk', main_menu, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Устав', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_two.v = not main_two.v
        end

        if imgui.Button(u8'Для Заместителей', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_four.v = not main_two.v
        end

        if imgui.Button(u8'П.Р.О', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_three.v = not main_three.v
        end

        imgui.End()
    end

    -- Main Two --

    if main_two.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(1100, 600), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Устав', main_two, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.InputTextMultiline(u8"", text_buffer, imgui.ImVec2(1300, 550)) then
            cfg.Settings.input = u8:decode(text_buffer.v)
            inicfg.save(cfg, 'config')
        end

        if imgui.Button(u8'Назад', imgui.ImVec2(1100,30)) then
            main_menu.v = not main_menu.v
            main_two.v = false
        end

        imgui.End()
    end

    -- Main Three --

    if main_three.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(1100, 600), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'П.Р.О', main_three, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.InputTextMultiline(u8"", buffer, imgui.ImVec2(1100, 535)) then
            cfg.Settings.input = u8:decode(buffer.v)
            inicfg1.save(cfg1, 'config1')
        end

        if imgui.Button(u8'Назад', imgui.ImVec2(1100,25)) then
            main_menu.v = not main_menu.v
            main_three.v = false
        end

        imgui.End()
    end

    -- Main Four --

    if main_four.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Для Заместителей/Лидера', main_four, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Увольнение', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_five.v = not main_five.v
        end

        if imgui.Button(u8'Собеседование', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_six.v = not main_six.v
        end

        if imgui.Button(u8'Звание', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_eight.v = not main_six.v
        end

        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
            main_menu.v = not main_menu.v
            main_four.v = false
        end

        imgui.End()
    end


        -- Main Five --

    if main_five.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Увольнение сотрудника', main_five, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Увольнение По Собственному Желанию', imgui.ImVec2(800, 30)) then
            local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : СЖ", "/do Процесс."}
            lua_thread.create(function()
                for k, v in ipairs(arr) do
                    sampSendChat(v)
                    wait(2000)
                end
                sampSetChatInputEnabled(true)
                sampSetChatInputText('/uninvite  Проф.Непригоден (СЖ)')
            end)
        end

        if imgui.Button(u8'Увольнение По Нарушению Устава', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : Н.У", "/do Процесс."}
                lua_thread.create(function()
                        for k, v in ipairs(arr) do
                                sampSendChat(v)
                                wait(2000)
                        end
                        sampSetChatInputEnabled(true)
                        sampSetChatInputText('/uninvite  Проф.Непригоден (Н.У)')
                end)
        end

        if imgui.Button(u8'Увольнение По Прогулу Рабочего Дня', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : Прогул Раб.Дня", "/do Процесс."}
                lua_thread.create(function()
                        for k, v in ipairs(arr) do
                                sampSendChat(v)
                                wait(2000)
                        end
                        sampSetChatInputEnabled(true)
                        sampSetChatInputText('/uninvite  Проф.Непригоден (Прогул Раб.Дня)')
                end)
        end

        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
            main_four.v = not main_four.v
            main_five.v = false
        end

            imgui.End()
        end

        -- Main Six --

        if main_six.v then

            local sw, sh = getScreenResolution()
            imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
            imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

            imgui.Begin(u8'Собеседование', main_six, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

            if imgui.Button(u8'Поприветствовать', imgui.ImVec2(800, 30)) then
                local arr = {"Добрый день.", "Я так понял, вы на собеседование", "Прошу предъявить мне пакет с лицензией", "И паспортом"}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('Хорошо...')
                end)
            end

            if imgui.Button(u8'Документы', imgui.ImVec2(800, 30)) then
                    local arr = {"/me протянул руку за пакетом", "/do Процесс.", "/me легким движением руки взял пакет, затем достал паспорт и лицензии", "/do Паспорт и лицензии в руках.", "/me открыл их на нужно странице, затем закрыл", "/do Лицензии и паспорт закрыты.", "/me положил лицензии и паспорт обратно, затем вернул их", "/do Процесс."}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Хорошо...')
                    end)
            end

            if imgui.Button(u8'Психология', imgui.ImVec2(800, 30)) then
                    local arr = {"Сейчас будет психологический тест", "Сядьте", "/b Вставай, годен!", "/b Вставай, годен!", "Вставайте", "Вы молодец, прошли тест!"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Хорошо...')
                    end)
            end

            if imgui.Button(u8'Терминология', imgui.ImVec2(800, 30)) then
                    local arr = {"Пока я заполняю бланк, вы можете постоять", "/b ДМ, ТК, МГ в /b", "/me достал бланк с вопросами", "/me ввёл ответы кандидата", "/do Процесс.", "/me написал оценку под бланком, затем убрал его", "/do Процесс.", "/b ДМ, ТК, МГ в /b", "Хорошо..."}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Я думаю, вы нам подходите.')
                    end)
            end

            if imgui.Button(u8'Годен!', imgui.ImVec2(800, 30)) then
                    local arr = {"Я вас поздравляю! Вот возьмите жетон и форму.", "/me достал пакет из под стола, затем разрезал его ножом", "/do Процесс.", "/me положил одежду и жетон на стол", "/do Процесс.", "Вот берите.", "Счастливой работы!"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('/invite ')
                    end)
            end

            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                main_five.v = not main_five.v
                main_six.v = false
            end

                imgui.End()
            end

        -- Main Eight --

        if main_eight.v then

            local sw, sh = getScreenResolution()
            imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
            imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

            imgui.Begin(u8'Звание', main_eight, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

            if imgui.Button(u8'Выдать', imgui.ImVec2(800, 30)) then
                   local arr = {"Поздравляю! Ты повышен!", "/me достал жетон из правого кармана", "/do Жетон в руке.", "/me лёгким движением руки с гордостью передал его", "/do Процесс."}
                   lua_thread.create(function()
                       for k, v in ipairs(arr) do
                           sampSendChat(v)
                           wait(2000)
                       end
                       sampSetChatInputEnabled(true)
                       sampSetChatInputText('/setrank')
                    end)
            end

            if imgui.Button(u8'Забрать', imgui.ImVec2(800, 30)) then
                     local arr = {"Плохо! Отдавай свой жетон!", "/me забрал жетон у человека напротив, затем убрал его в карман", "/do Процесс.", "Можешь идти! Чтобы больше такого не повторялось"}
                     lua_thread.create(function()
                             for k, v in ipairs(arr) do
                                     sampSendChat(v)
                                     wait(2000)
                             end
                             sampSetChatInputEnabled(true)
                             sampSetChatInputText('/setrank')
                        end)
            end

            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                main_six.v = not main_six.v
                main_eight.v = false
            end

                imgui.End()
            end
end

Так вижу решение проблемы я. Сколько людей - столько и мнений.
Lua:
local inicfg = require('inicfg')
local cfg = inicfg.load({
    ['Settings'] = {
        ['Input_1'] = "",
        ['Input_2'] = "",
        -- и т.д.
    }
}, 'config')
inicfg.save(cfg, 'config')
-- или можно при первом запуске через doesFileExist проверить, есть ли ini в папке и если нет -
-- через for прогнать сколько тебе надо этих полей, если тебе прям дофига инпутов надо)
--[[

if not doesFileExist(getWorkingDirectory()..'\\config\\config.ini') then
    local cfg = inicfg.load({
        ["Settings"] = {},
    }, 'config')
    for i = 1, 10 do
        cfg.Settings['Input_'..i..''] = "";
    end
    inicfg.save(cfg, 'config')
else
    local cfg = inicfg.load({
        ["Settings"] = {
            ["Input_1"] = "",
            ["Input_2"] = "",
            -- и т.д.
        },
    }, 'config')
    inicfg.save(cfg, 'config')
end

-- что-то вроде такого. Сорян если говнокод)

]]

local text_buffer = imgui.ImBuffer(u8(cfg.Settings.Input1), 10000)
local buffer = imgui.ImBuffer(u8(cfg.Settings.Input2), 10000)

-- тут весь твой код, не посмотрел весь.

-- и где ты сохраняешь в иник
    if imgui.InputTextMultiline(u8"", text_buffer, imgui.ImVec2(1300, 550)) then
        cfg.Settings.Input_1 = u8:decode(text_buffer.v)
        inicfg.save(cfg, 'config')
    end
-- ==================================
    if imgui.InputTextMultiline(u8"", buffer, imgui.ImVec2(1100, 535)) then
        cfg.Settings.Input_2 = u8:decode(buffer.v)
        inicfg.save(cfg, 'config')
    end
-- ==================================
-- Конечно каждый кадр обновлять инфу в инике, считаю, такое себе.
-- Мне кажется лучше это делать при выгрузке скрипта, а в кадрах только перезаписывать локальные данные
function imgui.OnDrawFrame()
-- ...
    if main_two.v then
        if imgui.InputTextMultiline(u8"", text_buffer, imgui.ImVec2(1300, 550)) then
            cfg.Settings.Input_1 = u8:decode(text_buffer.v)
        end
    end
-- ...
    if main_three.v then
        if imgui.InputTextMultiline(u8"", buffer, imgui.ImVec2(1100, 535)) then
            cfg.Settings.Input_2 = u8:decode(buffer.v)
        end
    end
-- ...
end
-- ==================================
function onScriptTerminate(s, q)
    inicfg.save(cfg, 'config')
end
 

Corrygаn

Участник
225
6
У меня есть флудер состоящий из трех строк.
text_buffer1
text_buffer2
text_buffer3
Как сделать так,, чтобы по нажатию кнопки "Start flood", текст записанный в text_buffer1, text_buffer2 и text_buffer3 сохранялся в .ini
P.S. text_zader1/2/3 - это инпут текст для задержки между отправкой флудера.
Флудер:
local text_buffer1 = imgui.ImBuffer(256)
local text_buffer2 = imgui.ImBuffer(256)
local text_buffer3 = imgui.ImBuffer(256)
local text_zader1 = imgui.ImBuffer(256)
local text_zader2 = imgui.ImBuffer(256)
local text_zader3 = imgui.ImBuffer(256)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    stproflood = false
    ndproflood = false
    rdproflood = false

    imgui.Process = false
    apply_custom_style()

    while true do
        wait(0)

        if main_window_helper.v == false then
            imgui.Process = false
        end
    end
end

function imgui.OnDrawFrame()
    imgui.Begin("", main_window_helper, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
    imgui.InputText(u8"Первая строка", text_buffer1)
    imgui.InputText(u8"Задержка", text_zader1)
    imgui.InputText(u8"Вторая строка", text_buffer2)
    imgui.InputText(u8"Задержка", text_zader2)
    imgui.InputText(u8"Третья строка", text_buffer3)
    imgui.InputText(u8"Задержка", text_zader3)
    if imgui.Button("Start flood", imgui.ImVec2(210, 40)) then
        sampAddChatMessage("[Central Market Helper]: " .. white_colour .. "Флудер активирован.", 0x256F60)
        stproflood = true
        ndproflood = true
        rdproflood = true
    end
    imgui.SameLine()
    imgui.SameLine()
    if imgui.Button("End flood", imgui.ImVec2(210, 40)) then
        sampAddChatMessage("[Central Market Helper]: " .. white_colour .. "Флудер деактивирован.", 0x256F60)
        stproflood = false
        ndproflood = false
        rdproflood = false
    end
    imgui.End()
end

function stproflood()
    while true do
        wait(text_zader1.v)
        if stproflood then
            sampSendChat(u8:decode(text_buffer1.v))
        end
    end
end

function ndproflood()
    while true do
        wait(text_zader2.v)
        if ndproflood then
            sampSendChat(u8:decode(text_buffer2.v))
        end
    end
end

function rdproflood()
    while true do
        wait(text_zader3.v)
        if rdproflood then
            sampSendChat(u8:decode(text_buffer3.v))
        end
    end
end
 

PanSeek

t.me/dailypanseek
Всефорумный модератор
899
1,745
Вопрос к вам люди. Как сделать чтобы сохранялись Buffer? Я уже и так и сяк, и менял переменные, в итоге они нифега не сохраняются. Либо сохраняются, но потом исчезают. Мне нужно 2 и больше Buffer. Помогите

Code:
script_name('CMI Helper')
script_author('Wilman')

require "lib.moonloader"

local tag = '[ CMI ] Namalsk - '
local imgui = require 'imgui'
local label = 0
local keys = require  'vkeys'
local inicfg = require 'inicfg'
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

-- Main's --

local main_menu = imgui.ImBool(false)
local main_two = imgui.ImBool(false)
local main_three = imgui.ImBool(false)
local main_four = imgui.ImBool(false)
local main_five = imgui.ImBool(false)
local main_six = imgui.ImBool(false)
local main_seven = imgui.ImBool(false)
local main_eight = imgui.ImBool(false)
local main_nine = imgui.ImBool(false)
local main_ten = imgui.ImBool(false)



-- Main's --

local inicfg = require 'inicfg'
local cfg = inicfg.load({
    Settings = {
        input = ""
    }
}, 'config')

local inicfg1 = require 'inicfg'
local cfg1 = inicfg1.load({
    Settings = {
        input = ""
    }
}, 'config1')

local text_buffer = imgui.ImBuffer(u8(cfg.Settings.input), 10000)
local buffer = imgui.ImBuffer(u8(cfg.Settings.input), 10000)



local sw, sh = getScreenResolution()

function apply_custom_style()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    style.WindowRounding = 2.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
    style.ChildWindowRounding = 2.0
    style.FrameRounding = 2.0
    style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
    style.ScrollbarSize = 13.0
    style.ScrollbarRounding = 0
    style.GrabMinSize = 8.0
    style.GrabRounding = 1.0

    colors[clr.FrameBg]                = ImVec4(0.16, 0.48, 0.42, 100)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 100)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.48, 0.42, 100)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 100)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.88, 0.77, 100)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Button]                 = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.98, 0.82, 100)
    colors[clr.Header]                 = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.10, 0.75, 0.63, 100)
    colors[clr.SeparatorActive]        = ImVec4(0.10, 0.75, 0.63, 100)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 100)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.81, 0.35, 100)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 100)
    colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 100)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 100)
    colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 100)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 100)
    colors[clr.ComboBg]                = colors[clr.PopupBg]
    colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 100)
    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 100)
    colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 100)
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 100)
    colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 100)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 100)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 100)
    colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 100)
    colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 100)
    colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 100)
    colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 100)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 100)
    colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 100)
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
        while not isSampAvailable() do wait(100) end

        sampRegisterChatCommand("nh", function ()
            main_menu.v = not main_menu.v
            imgui.Process = main_menu.v
            imgui.ShowCursor = main_menu.v
        end)

        imgui.Process = false

        sampAddChatMessage(tag .. "{FFFFFF}А{5A90CE}ктивирован!", main_color)

        while true do
            wait(0)

            imgui.Process = main_menu.v or main_two.v or main_three.v or main_four.v or main_five.v or main_six.v or main_eight.v or main_nine.v or main_seven.v

            if main_menu.v or main_two.v or main_three.v or main_four.v or main_five.v or main_six.v or main_eight.v or main_nine.v or main_seven.v then
                    imgui.ShowCursor = true
            else
                    imgui.ShowCursor = false
            end
    end
end

function imgui.OnDrawFrame()

    if not main_menu.v and not main_two.v and not main_three.v and not main_four and not main_five.v and not main_six.v and not main_eight.v and not main_nine.v and not main_ten.v and not main_seven.v then
            imgui.Process = false
    end

    -- Main Menu --

    if main_menu.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'CMI Helper - Namalsk', main_menu, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Устав', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_two.v = not main_two.v
        end

        if imgui.Button(u8'Для Заместителей', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_four.v = not main_two.v
        end

        if imgui.Button(u8'П.Р.О', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_three.v = not main_three.v
        end

        imgui.End()
    end

    -- Main Two --

    if main_two.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(1100, 600), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Устав', main_two, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.InputTextMultiline(u8"", text_buffer, imgui.ImVec2(1300, 550)) then
            cfg.Settings.input = u8:decode(text_buffer.v)
            inicfg.save(cfg, 'config')
        end

        if imgui.Button(u8'Назад', imgui.ImVec2(1100,30)) then
            main_menu.v = not main_menu.v
            main_two.v = false
        end

        imgui.End()
    end

    -- Main Three --

    if main_three.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(1100, 600), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'П.Р.О', main_three, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.InputTextMultiline(u8"", buffer, imgui.ImVec2(1100, 535)) then
            cfg.Settings.input = u8:decode(buffer.v)
            inicfg1.save(cfg1, 'config1')
        end

        if imgui.Button(u8'Назад', imgui.ImVec2(1100,25)) then
            main_menu.v = not main_menu.v
            main_three.v = false
        end

        imgui.End()
    end

    -- Main Four --

    if main_four.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Для Заместителей/Лидера', main_four, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Увольнение', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_five.v = not main_five.v
        end

        if imgui.Button(u8'Собеседование', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_six.v = not main_six.v
        end

        if imgui.Button(u8'Звание', imgui.ImVec2(800,30)) then
            main_four.v = false
            main_eight.v = not main_six.v
        end

        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
            main_menu.v = not main_menu.v
            main_four.v = false
        end

        imgui.End()
    end


        -- Main Five --

    if main_five.v then

        local sw, sh = getScreenResolution()
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.Begin(u8'Увольнение сотрудника', main_five, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

        if imgui.Button(u8'Увольнение По Собственному Желанию', imgui.ImVec2(800, 30)) then
            local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : СЖ", "/do Процесс."}
            lua_thread.create(function()
                for k, v in ipairs(arr) do
                    sampSendChat(v)
                    wait(2000)
                end
                sampSetChatInputEnabled(true)
                sampSetChatInputText('/uninvite  Проф.Непригоден (СЖ)')
            end)
        end

        if imgui.Button(u8'Увольнение По Нарушению Устава', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : Н.У", "/do Процесс."}
                lua_thread.create(function()
                        for k, v in ipairs(arr) do
                                sampSendChat(v)
                                wait(2000)
                        end
                        sampSetChatInputEnabled(true)
                        sampSetChatInputText('/uninvite  Проф.Непригоден (Н.У)')
                end)
        end

        if imgui.Button(u8'Увольнение По Прогулу Рабочего Дня', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : Прогул Раб.Дня", "/do Процесс."}
                lua_thread.create(function()
                        for k, v in ipairs(arr) do
                                sampSendChat(v)
                                wait(2000)
                        end
                        sampSetChatInputEnabled(true)
                        sampSetChatInputText('/uninvite  Проф.Непригоден (Прогул Раб.Дня)')
                end)
        end

        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
            main_four.v = not main_four.v
            main_five.v = false
        end

            imgui.End()
        end

        -- Main Six --

        if main_six.v then

            local sw, sh = getScreenResolution()
            imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
            imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

            imgui.Begin(u8'Собеседование', main_six, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

            if imgui.Button(u8'Поприветствовать', imgui.ImVec2(800, 30)) then
                local arr = {"Добрый день.", "Я так понял, вы на собеседование", "Прошу предъявить мне пакет с лицензией", "И паспортом"}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('Хорошо...')
                end)
            end

            if imgui.Button(u8'Документы', imgui.ImVec2(800, 30)) then
                    local arr = {"/me протянул руку за пакетом", "/do Процесс.", "/me легким движением руки взял пакет, затем достал паспорт и лицензии", "/do Паспорт и лицензии в руках.", "/me открыл их на нужно странице, затем закрыл", "/do Лицензии и паспорт закрыты.", "/me положил лицензии и паспорт обратно, затем вернул их", "/do Процесс."}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Хорошо...')
                    end)
            end

            if imgui.Button(u8'Психология', imgui.ImVec2(800, 30)) then
                    local arr = {"Сейчас будет психологический тест", "Сядьте", "/b Вставай, годен!", "/b Вставай, годен!", "Вставайте", "Вы молодец, прошли тест!"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Хорошо...')
                    end)
            end

            if imgui.Button(u8'Терминология', imgui.ImVec2(800, 30)) then
                    local arr = {"Пока я заполняю бланк, вы можете постоять", "/b ДМ, ТК, МГ в /b", "/me достал бланк с вопросами", "/me ввёл ответы кандидата", "/do Процесс.", "/me написал оценку под бланком, затем убрал его", "/do Процесс.", "/b ДМ, ТК, МГ в /b", "Хорошо..."}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('Я думаю, вы нам подходите.')
                    end)
            end

            if imgui.Button(u8'Годен!', imgui.ImVec2(800, 30)) then
                    local arr = {"Я вас поздравляю! Вот возьмите жетон и форму.", "/me достал пакет из под стола, затем разрезал его ножом", "/do Процесс.", "/me положил одежду и жетон на стол", "/do Процесс.", "Вот берите.", "Счастливой работы!"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                            sampSetChatInputText('/invite ')
                    end)
            end

            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                main_five.v = not main_five.v
                main_six.v = false
            end

                imgui.End()
            end

        -- Main Eight --

        if main_eight.v then

            local sw, sh = getScreenResolution()
            imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
            imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

            imgui.Begin(u8'Звание', main_eight, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

            if imgui.Button(u8'Выдать', imgui.ImVec2(800, 30)) then
                   local arr = {"Поздравляю! Ты повышен!", "/me достал жетон из правого кармана", "/do Жетон в руке.", "/me лёгким движением руки с гордостью передал его", "/do Процесс."}
                   lua_thread.create(function()
                       for k, v in ipairs(arr) do
                           sampSendChat(v)
                           wait(2000)
                       end
                       sampSetChatInputEnabled(true)
                       sampSetChatInputText('/setrank')
                    end)
            end

            if imgui.Button(u8'Забрать', imgui.ImVec2(800, 30)) then
                     local arr = {"Плохо! Отдавай свой жетон!", "/me забрал жетон у человека напротив, затем убрал его в карман", "/do Процесс.", "Можешь идти! Чтобы больше такого не повторялось"}
                     lua_thread.create(function()
                             for k, v in ipairs(arr) do
                                     sampSendChat(v)
                                     wait(2000)
                             end
                             sampSetChatInputEnabled(true)
                             sampSetChatInputText('/setrank')
                        end)
            end

            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            imgui.Text(" ")
            if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                main_six.v = not main_six.v
                main_eight.v = false
            end

                imgui.End()
            end
end
Изучи циклы, как правильно подключать библиотеки (у тебя inicfg была подключена несколько раз), что такое табуляция. Насчет inicfg, есть информация в виках.
Текст и стиль не переделывал. Кстати стиль не применялся у тебя, я применил и он слишком едкий, сам увидишь.
Сам не уверен что код нормальный, но он стал лучше и рекомендую перейти на mimgui.
Lua:
script_name('CMI Helper')
script_author('Wilman')
--libs
require "lib.moonloader"
local keys = require  'vkeys'
local inicfg = require 'inicfg'
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
--params
local tag = '[ CMI ] Namalsk - '
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
--cfg
local cfg = inicfg.load({
    Settings = {
        input = "",
        input2 = ""
    }
}, 'test420')
--params imgui
local main_menu = imgui.ImBool(false)
local act = 0
local text_buffer = imgui.ImBuffer(u8(cfg.Settings.input), 10000)
local buffer = imgui.ImBuffer(u8(cfg.Settings.input2), 10000)
local sw, sh = getScreenResolution()
function apply_custom_style()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4
    style.WindowRounding = 2.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
    style.ChildWindowRounding = 2.0
    style.FrameRounding = 2.0
    style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
    style.ScrollbarSize = 13.0
    style.ScrollbarRounding = 0
    style.GrabMinSize = 8.0
    style.GrabRounding = 1.0
    colors[clr.FrameBg]                = ImVec4(0.16, 0.48, 0.42, 100)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 100)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.48, 0.42, 100)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 100)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.88, 0.77, 100)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Button]                 = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.98, 0.82, 100)
    colors[clr.Header]                 = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.10, 0.75, 0.63, 100)
    colors[clr.SeparatorActive]        = ImVec4(0.10, 0.75, 0.63, 100)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 100)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.81, 0.35, 100)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.98, 0.85, 100)
    colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 100)
    colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 100)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 100)
    colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 100)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 100)
    colors[clr.ComboBg]                = colors[clr.PopupBg]
    colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 100)
    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 100)
    colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 100)
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 100)
    colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 100)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 100)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 100)
    colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 100)
    colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 100)
    colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 100)
    colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 100)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 100)
    colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 100)
end
apply_custom_style() -- если стиль не нужен пока, удалить
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage(tag .. "{FFFFFF}А{5A90CE}ктивирован!", main_color)
    sampRegisterChatCommand("nh", function () main_menu.v = not main_menu.v end)
  
    while true do
        wait(0)
        imgui.Process = main_menu.v
        imgui.ShowCursor = main_menu.v
    end
end
function imgui.OnDrawFrame()
    if main_menu.v then
        imgui.SetNextWindowSize(imgui.ImVec2(800, 500), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(act == 1 and u8 'Устав' or act == 2 and u8'Для Заместителей/Лидера' or act == 3 and u8'П.Р.О' or act == 4 and u8'Увольнение сотрудника' or act == 5 and u8'Собеседование' or act == 6 and u8'Звание' or u8'CMI Helper - Namalsk', main_menu, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)
        if act == 0 then
            imgui.BeginChild('##main', imgui.ImVec2(-1, -1), false)
            if imgui.Button(u8'Устав', imgui.ImVec2(800,30)) then act = 1 end
            if imgui.Button(u8'Для Заместителей', imgui.ImVec2(800,30)) then act = 2 end
            if imgui.Button(u8'П.Р.О', imgui.ImVec2(800,30)) then act = 3 end
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##ustav', imgui.ImVec2(-1, -1), false)
            if imgui.InputTextMultiline(u8"", text_buffer, imgui.ImVec2(-1, 400)) then
                cfg.Settings.input = u8:decode(text_buffer.v)
            end
            if imgui.Button(u8'Назад', imgui.ImVec2(-1, 30)) then act = 0; inicfg.save(cfg, 'test420') end
            imgui.EndChild()
        elseif act == 2 then
            imgui.BeginChild('##zam', imgui.ImVec2(-1, -1), false)
            if imgui.Button(u8'Увольнение', imgui.ImVec2(800,30)) then act = 4 end
            if imgui.Button(u8'Собеседование', imgui.ImVec2(800,30)) then act = 5 end
            if imgui.Button(u8'Звание', imgui.ImVec2(800,30)) then act = 6 end
            for i = 0, 17 do imgui.NewLine() end
            if imgui.Button(u8'Назад', imgui.ImVec2(-1, 30)) then act = 0 end
            imgui.EndChild()
        elseif act == 3 then
            imgui.BeginChild('##pro', imgui.ImVec2(-1, -1), false)
            if imgui.InputTextMultiline(u8"", buffer, imgui.ImVec2(-1, 400)) then
                cfg.Settings.input2 = u8:decode(buffer.v)
            end
            if imgui.Button(u8'Назад', imgui.ImVec2(-1, 30)) then act = 0; inicfg.save(cfg, 'test420') end
            imgui.EndChild()
        elseif act == 4 then
            imgui.BeginChild('##uval', imgui.ImVec2(-1, -1), false)
            if imgui.Button(u8'Увольнение По Собственному Желанию', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : СЖ", "/do Процесс."}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('/uninvite  Проф.Непригоден (СЖ)')
                end)
            end
            if imgui.Button(u8'Увольнение По Нарушению Устава', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : Н.У", "/do Процесс."}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('/uninvite  Проф.Непригоден (Н.У)')
                end)
            end
            if imgui.Button(u8'Увольнение По Прогулу Рабочего Дня', imgui.ImVec2(800, 30)) then
                local arr = {"/do Сумка на плече.", "/do Планшет находится в сумке.", "/me движением правой руки достал планшет из сумки", "/do Планшет в руках.", "/me зашёл в раздел 'Сотрудники'", "/me удалил сотрудника из раздела, по причине : Прогул Раб.Дня", "/do Процесс."}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('/uninvite  Проф.Непригоден (Прогул Раб.Дня)')
                end)
            end
            for i = 0, 17 do imgui.NewLine() end
            if imgui.Button(u8'Назад', imgui.ImVec2(-1, 30)) then act = 2 end
            imgui.EndChild()
        elseif act == 5 then
            imgui.BeginChild('##sobes', imgui.ImVec2(-1, -1), false)
            if imgui.Button(u8'Поприветствовать', imgui.ImVec2(800, 30)) then
                local arr = {"Добрый день.", "Я так понял, вы на собеседование", "Прошу предъявить мне пакет с лицензией", "И паспортом"}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('Хорошо...')
                end)
            end
            if imgui.Button(u8'Документы', imgui.ImVec2(800, 30)) then
                local arr = {"/me протянул руку за пакетом", "/do Процесс.", "/me легким движением руки взял пакет, затем достал паспорт и лицензии", "/do Паспорт и лицензии в руках.", "/me открыл их на нужно странице, затем закрыл", "/do Лицензии и паспорт закрыты.", "/me положил лицензии и паспорт обратно, затем вернул их", "/do Процесс."}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('Хорошо...')
                end)
            end
            if imgui.Button(u8'Психология', imgui.ImVec2(800, 30)) then
                local arr = {"Сейчас будет психологический тест", "Сядьте", "/b Вставай, годен!", "/b Вставай, годен!", "Вставайте", "Вы молодец, прошли тест!"}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('Хорошо...')
                end)
            end
            if imgui.Button(u8'Терминология', imgui.ImVec2(800, 30)) then
                local arr = {"Пока я заполняю бланк, вы можете постоять", "/b ДМ, ТК, МГ в /b", "/me достал бланк с вопросами", "/me ввёл ответы кандидата", "/do Процесс.", "/me написал оценку под бланком, затем убрал его", "/do Процесс.", "/b ДМ, ТК, МГ в /b", "Хорошо..."}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('Я думаю, вы нам подходите.')
                end)
            end
            if imgui.Button(u8'Годен!', imgui.ImVec2(800, 30)) then
                local arr = {"Я вас поздравляю! Вот возьмите жетон и форму.", "/me достал пакет из под стола, затем разрезал его ножом", "/do Процесс.", "/me положил одежду и жетон на стол", "/do Процесс.", "Вот берите.", "Счастливой работы!"}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('/invite ')
                end)
            end
            for i = 0, 14 do imgui.NewLine() end
            if imgui.Button(u8'Назад', imgui.ImVec2(-1, 30)) then act = 2 end
            imgui.EndChild()
        elseif act == 6 then
            imgui.BeginChild('##rank', imgui.ImVec2(-1, -1), false)
            if imgui.Button(u8'Выдать', imgui.ImVec2(800, 30)) then
                local arr = {"Поздравляю! Ты повышен!", "/me достал жетон из правого кармана", "/do Жетон в руке.", "/me лёгким движением руки с гордостью передал его", "/do Процесс."}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('/setrank')
                end)
            end
            if imgui.Button(u8'Забрать', imgui.ImVec2(800, 30)) then
                local arr = {"Плохо! Отдавай свой жетон!", "/me забрал жетон у человека напротив, затем убрал его в карман", "/do Процесс.", "Можешь идти! Чтобы больше такого не повторялось"}
                lua_thread.create(function()
                    for k, v in ipairs(arr) do
                        sampSendChat(v)
                        wait(2000)
                    end
                    sampSetChatInputEnabled(true)
                    sampSetChatInputText('/setrank')
                end)
            end
            for i = 0, 13 do imgui.NewLine() end
            if imgui.Button(u8'Назад', imgui.ImVec2(-1, 30)) then act = 2 end
            imgui.EndChild()
        end
    end
    imgui.End()
end

UPD: Надеюсь не зря я потратил примерно час на разбор скрипта и понять что и как должно быть. Потом как понял, сделал довольно быстро.
 

Вложения

  • Untitled-1.lua
    14.3 KB · Просмотры: 6
  • Нравится
Реакции: James Saula

Corrygаn

Участник
225
6
Хотел бы поинтересоваться что такое mimgui? Многие пишут про это, но судя по названию, что-то связанное с imgui
 

Andrinall

Известный
679
532
У меня есть флудер состоящий из трех строк.
text_buffer1
text_buffer2
text_buffer3
Как сделать так,, чтобы по нажатию кнопки "Start flood", текст записанный в text_buffer1, text_buffer2 и text_buffer3 сохранялся в .ini
P.S. text_zader1/2/3 - это инпут текст для задержки между отправкой флудера.
Флудер:
local text_buffer1 = imgui.ImBuffer(256)
local text_buffer2 = imgui.ImBuffer(256)
local text_buffer3 = imgui.ImBuffer(256)
local text_zader1 = imgui.ImBuffer(256)
local text_zader2 = imgui.ImBuffer(256)
local text_zader3 = imgui.ImBuffer(256)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    stproflood = false
    ndproflood = false
    rdproflood = false

    imgui.Process = false
    apply_custom_style()

    while true do
        wait(0)

        if main_window_helper.v == false then
            imgui.Process = false
        end
    end
end

function imgui.OnDrawFrame()
    imgui.Begin("", main_window_helper, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
    imgui.InputText(u8"Первая строка", text_buffer1)
    imgui.InputText(u8"Задержка", text_zader1)
    imgui.InputText(u8"Вторая строка", text_buffer2)
    imgui.InputText(u8"Задержка", text_zader2)
    imgui.InputText(u8"Третья строка", text_buffer3)
    imgui.InputText(u8"Задержка", text_zader3)
    if imgui.Button("Start flood", imgui.ImVec2(210, 40)) then
        sampAddChatMessage("[Central Market Helper]: " .. white_colour .. "Флудер активирован.", 0x256F60)
        stproflood = true
        ndproflood = true
        rdproflood = true
    end
    imgui.SameLine()
    imgui.SameLine()
    if imgui.Button("End flood", imgui.ImVec2(210, 40)) then
        sampAddChatMessage("[Central Market Helper]: " .. white_colour .. "Флудер деактивирован.", 0x256F60)
        stproflood = false
        ndproflood = false
        rdproflood = false
    end
    imgui.End()
end

function stproflood()
    while true do
        wait(text_zader1.v)
        if stproflood then
            sampSendChat(u8:decode(text_buffer1.v))
        end
    end
end

function ndproflood()
    while true do
        wait(text_zader2.v)
        if ndproflood then
            sampSendChat(u8:decode(text_buffer2.v))
        end
    end
end

function rdproflood()
    while true do
        wait(text_zader3.v)
        if rdproflood then
            sampSendChat(u8:decode(text_buffer3.v))
        end
    end
end
Ты про это?

Lua:
local inicfg = require('inicfg')
local cfg = inicfg.load({}, 'flood_cfg') -- по идее можно в шаблон пустую таблицу задать, если нет -
--[[
local cfg = inicfg.load({
    ['Buffer_1'] = "",
    ['Buffer_2'] = "",
    ['Buffer_3'] = "",
}, 'flood_cfg')
]] -- Но скорее всего можно и пустую )))

-- в onDrawFrame
    if imgui.Button("Start flood", imgui.ImVec2(210, 40)) then
        cfg.Buffer_1 = text_buffer1.v
        cfg.Buffer_2 = text_buffer2.v
        cfg.Buffer_3 = text_buffer3.v
        inicfg.save(cfg, 'flood_cfg')

        sampAddChatMessage("[Central Market Helper]: " .. white_colour .. "Флудер активирован.", 0x256F60)

        stproflood = true
        ndproflood = true
        rdproflood = true
    end
--=============
 

Andrinall

Известный
679
532
Хотел бы поинтересоваться что такое mimgui? Многие пишут про это, но судя по названию, что-то связанное с imgui
 

PanSeek

t.me/dailypanseek
Всефорумный модератор
899
1,745
Как отправлять синхру, к примеру персонаж под дорогой или в небе, также насчет машины, не могу понять как работает это. Проясните пожалуйста ❤️
 
  • Нравится
Реакции: James Saula

F. Salisburry

Участник
42
11
5 сек, подниму жопу с дивана и доползу до ноута
onSetMapIcon, ид его иконки - 19
code:
local ev = require 'lib.samp.events'
local act = false
function main()
    repeat wait(0) until isSampAvailable()
    sampRegisterChatCommand('markert', function()
    act = not act
    if act then
        sampAddChatMessage('{ECE20B}[] {FFFFFF}Текущее состояние бота: {45e630}Включено', -1)
    else
        sampAddChatMessage('{ECE20B}[] {FFFFFF}Текущее состояние бота: {e63030}Выключено', -1)
    end
    end)
    while true do wait(0)
    if act then
        function ev.onSetMapIcon(iconId)
        if iconId == 19 then
        sampSendChat('A')
        end
    end
end

Че-то не получается
 

PanSeek

t.me/dailypanseek
Всефорумный модератор
899
1,745
code:
local ev = require 'lib.samp.events'
local act = false
function main()
    repeat wait(0) until isSampAvailable()
    sampRegisterChatCommand('markert', function()
    act = not act
    if act then
        sampAddChatMessage('{ECE20B}[] {FFFFFF}Текущее состояние бота: {45e630}Включено', -1)
    else
        sampAddChatMessage('{ECE20B}[] {FFFFFF}Текущее состояние бота: {e63030}Выключено', -1)
    end
    end)
    while true do wait(0)
    if act then
        function ev.onSetMapIcon(iconId)
        if iconId == 19 then
        sampSendChat('A')
        end
    end
end

Че-то не получается
Lua:
local ev = require 'lib.samp.events'
local act = false
function main()
    repeat wait(0) until isSampAvailable()
    sampRegisterChatCommand('markert', function()
        act = not act
        sampAddChatMessage('{ECE20B}[] {FFFFFF}Текущее состояние бота: ' ..(act and '{45e630}Включено' or '{e63030}Выключено'), -1)
    end)
    wait(-1)
end

function ev.onSetMapIcon(iconId)
    if iconId == 19 then
        sampSendChat('A')
    end
end
 
  • Нравится
Реакции: James Saula

Corrygаn

Участник
225
6
Ты про это?

Lua:
local inicfg = require('inicfg')
local cfg = inicfg.load({}, 'flood_cfg') -- по идее можно в шаблон пустую таблицу задать, если нет -
--[[
local cfg = inicfg.load({
    ['Buffer_1'] = "",
    ['Buffer_2'] = "",
    ['Buffer_3'] = "",
}, 'flood_cfg')
]] -- Но скорее всего можно и пустую )))

-- в onDrawFrame
    if imgui.Button("Start flood", imgui.ImVec2(210, 40)) then
        cfg.Buffer_1 = text_buffer1.v
        cfg.Buffer_2 = text_buffer2.v
        cfg.Buffer_3 = text_buffer3.v
        inicfg.save(cfg, 'flood_cfg')

        sampAddChatMessage("[Central Market Helper]: " .. white_colour .. "Флудер активирован.", 0x256F60)

        stproflood = true
        ndproflood = true
        rdproflood = true
    end
--=============
А мне нужно самому создать файл .ini? Или скрипт сам создаст его?
 

PanSeek

t.me/dailypanseek
Всефорумный модератор
899
1,745
А мне нужно самому создать файл .ini? Или скрипт сам создаст его?
Если не прописано, то не создаться.
Чтоб создавался сам:
if not doesFileExist('moonloader/config/название.ini') then
    inicfg.save(названиеИни, 'название.ini')
end
 
  • Нравится
Реакции: James Saula

Corrygаn

Участник
225
6
Если не прописано, то не создаться.
Чтоб создавался сам:
if not doesFileExist('moonloader/config/название.ini') then
    inicfg.save(названиеИни, 'название.ini')
end
Screenshot_52.png
Screenshot_51.png