Вопросы по 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
 
Последнее редактирование:

Vintik

Мечтатель
Проверенный
1,471
920
 

KIBERSTALKER

Участник
30
2
Люди, хелп. Я чёт сделал, и у меня появляется мышка при запуске игры

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)
local main_1 = imgui.ImBool(false)
local main_2 = imgui.ImBool(false)
local main_3 = imgui.ImBool(false)
local main_4 = imgui.ImBool(false)
local main_5 = imgui.ImBool(false)
local main_6 = imgui.ImBool(false)
local main_7 = imgui.ImBool(false)
local main_8 = imgui.ImBool(false)
local main_9 = imgui.ImBool(false)
local main_10 = imgui.ImBool(false)




-- Main's --

local inicfg = require 'inicfg'
local cfg = inicfg.load({
    Settings = {
        input = "",
                input2 = "",
                input3 = "",
                input4 = "",
                input5 = "",
                input6 = "",
                input7 = "",
                input8 = "",
                input9 = "",
                input10 = ""
    }
}, 'config')

local text_buffer = imgui.ImBuffer(u8(cfg.Settings.input), 10000)
local buffer = imgui.ImBuffer(u8(cfg.Settings.input2), 10000)
local buffer_text = imgui.ImBuffer(u8(cfg.Settings.input3), 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

        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)

        sampRegisterChatCommand("nh", function()
          goKeyPressed(114)
        end)

        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 or main_1 or main_2 or main_3 or main_4 or main_5 or main_6 or main_7 or main_8 or main_9 or main_10

            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 or main_1 or main_2 or main_3 or main_4 or main_5 or main_6 or main_7 or main_8 or main_9 or main_10 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 and not main_1 and not main_2 and not main_3 and not main_4 and not main_5 and not main_6 and not main_7 and not main_8 and not main_9 and not main_10 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_nine.v = not main_nine.v
        end

        if imgui.Button(u8'Сдача П.Р.О и Устава', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_ten.v = not main_ten.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(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Закрыть', imgui.ImVec2(800,30)) then
            main_menu.v = false
        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(1300, 550)) then
            cfg.Settings.input2 = u8:decode(buffer.v)
            inicfg.save(cfg, 'config')
        end

        if imgui.Button(u8'Назад', imgui.ImVec2(1100,25)) then
            main_nine.v = not main_nine.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_four.v = not main_four.v
                main_six.v = false
            end

            imgui.End()
        end

            -- Main Seven --

            if main_seven.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_seven, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.InputTextMultiline(u8"", buffer_text, imgui.ImVec2(1100, 550)) then
                    cfg.Settings.input3 = u8:decode(buffer_text.v)
                    inicfg.save(cfg, 'config')
                end

                if imgui.Button(u8'Назад', imgui.ImVec2(1100,25)) then
                    main_nine.v = not main_nine.v
                    main_seven.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(" ")
            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_eight.v = false
            end

            imgui.End()
        end

            -- Main nine --

            if main_nine.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_nine, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.Button(u8'Правила редактирования объявлений', imgui.ImVec2(800, 30)) then
                    main_three.v = not main_three.v
                    main_nine.v = false
                end

                if imgui.Button(u8'Правила проведения эфиров', imgui.ImVec2(800, 30)) then
                    main_seven.v = not main_seven.v
                    main_nine.v = false
                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(" ")
                imgui.Text(" ")
                imgui.Text(" ")
                if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                    main_menu.v = not main_menu.v
                    main_nine.v = false
                end

                imgui.End()
            end

            -- Main Ten --

            if main_ten.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_ten, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.Button(u8'Вступление', imgui.ImVec2(800,30)) then
                    main_ten.v = false
                    main_1.v = not main_1.v
                end

                if imgui.Button(u8'Сдача П.Р.О', imgui.ImVec2(800,30)) then
                    main_ten.v = false
                    main_2.v = not main_2.v
                end

                if imgui.Button(u8'Сдача устава', imgui.ImVec2(800,30)) then
                    main_ten.v = false
                    main_3.v = not main_3.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_ten.v = false
                end

                imgui.End()
            end

            -- Main_1 --

            if main_1.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_1, 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
                     end)
                end

                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
                     end)
                end

                if imgui.Button(u8'Листочек', imgui.ImVec2(800, 30)) then
                    local arr = {"/me лёгким движением правой руки, открыл бордачёк стола", "/do Бордачёк открыт.", "/me достал листочек  из бордачка, затем положил на стол", "/do Процесс.", "/do Ручка находится рядом с листочком.", "/b Ответ в /do", "Ответ в /do", "Бери ручку и листочек, мы приступим."}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                     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(" ")
                imgui.Text(" ")
                imgui.Text(" ")
                imgui.Text(" ")
                imgui.Text(" ")
                if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                    main_ten.v = not main_ten.v
                    main_1.v = false
                end

                imgui.End()
            end

            -- Main_2 --

            if main_2.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_2, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.Button(u8'1.1 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.1 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'1.2 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.2 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.3 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.3 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.4 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.4 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.5 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.5 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.6 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.6 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.7 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.7 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.8 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.8 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     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(" ")
                if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                    main_ten.v = not main_ten.v
                    main_2.v = false
                end

                imgui.End()
            end

            -- Main_3 --

            if main_3.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_3, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.Button(u8'1.1 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.1 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'1.2 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.2 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.3 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.3 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.4 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.4 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.5 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.5 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.6 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.6 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.7 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.7 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.8 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.8 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'1.9 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.9 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.1 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.1 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.2 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.2 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.3 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.3 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.4 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.4 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.5 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.5 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.6 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.6 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.7 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.7 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'3.1 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 3.1 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'3.2 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 3.2 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'3.3 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 3.3 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'4.1 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 4.1 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'4.2 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 4.2 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'4.3 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 4.3 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

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

                imgui.End()
            end
end
 

Questel

Участник
151
13
Всем привет, наткнулся на ролик Ринжи где он просил сделать прием на работу в радиусе. Как написать прием игроков я примерно понимаю, но вот как сделать так что бы принялись все в радиусе не совсем. Подскажите плиз как сделать поиск айдишников в радиусе, и и вписывание в команду ^-^
 

Vintik

Мечтатель
Проверенный
1,471
920
Всем привет, наткнулся на ролик Ринжи где он просил сделать прием на работу в радиусе. Как написать прием игроков я примерно понимаю, но вот как сделать так что бы принялись все в радиусе не совсем. Подскажите плиз как сделать поиск айдишников в радиусе, и и вписывание в команду ^-^
Lua:
radius = 15 -- радиус
local peds = getAllChars()
positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
for _, ped in ipairs(peds) do
  local x, y, z = getCharCoordinates(ped)
  if getDistanceBetweenCoords3d(x, y, z, positionX, positionY, positionZ) < radius then
    local result, id = sampGetPlayerIdByCharHandle(ped)
    if result then
      sampAddChatMessage('Рядом игрок с ID: ' .. id)
    end
  end
end
 

SurnikSur

Активный
284
40
Lua:
local coord_master = false

function main()
  while not isSampAvailable() do wait(0) end
  sampRegisterChatCommand('teleport', teleport)
  wait(-1)
end

function teleport()
  local result, x, y, z = getTargetBlipCoordinates()
  if result and not coord_master then
    lua_thread.create(function()
      coord_master = true
      freezeCharPosition(PLAYER_PED, true)
      CoordMaster(34, 43, 23, 40, 300)
      freezeCharPosition(PLAYER_PED, false)
      coord_master = false
    end)
  e
Скорей я тупой не могу понять чё не так ...
 

Vintik

Мечтатель
Проверенный
1,471
920
Lua:
local coord_master = false

function main()
  while not isSampAvailable() do wait(0) end
  sampRegisterChatCommand('teleport', teleport)
  wait(-1)
end

function teleport()
  local result, x, y, z = getTargetBlipCoordinates()
  if result and not coord_master then
    lua_thread.create(function()
      coord_master = true
      freezeCharPosition(PLAYER_PED, true)
      CoordMaster(34, 43, 23, 40, 300)
      freezeCharPosition(PLAYER_PED, false)
      coord_master = false
    end)
  e
Скорей я тупой не могу понять чё не так ...
Lua:
local coord_master = false

function main()
  while not isSampAvailable() do wait(0) end
  sampRegisterChatCommand('teleport', teleport)
  wait(-1)
end

function teleport()
  local x, y, z = 34, 43, 23
  if not coord_master then
    lua_thread.create(function()
      coord_master = true
      freezeCharPosition(PLAYER_PED, true)
      CoordMaster(x, y, z, 40, 300) -- каждый тп на 40 метров, между ними 300 мс
      freezeCharPosition(PLAYER_PED, false)
      coord_master = false
    end)
  end
end

function CoordMaster(px, py, pz, step, time)
  local x, y, z = getCharCoordinates(PLAYER_PED)
  local d = getDistanceBetweenCoords3d(px, py, pz, x, y, z)
  if d <= step then
    setCharCoordinates(PLAYER_PED, px, py, pz)
  else
    local dx, dy, dz = px - x, py - y, pz - z
    x = x + step / d * dx
    y = y + step / d * dy
    z = z + step / d * dz
    setCharCoordinates(PLAYER_PED, x, y, z)
    wait(time)
    CoordMaster(px, py, pz, step, time)
  end
end
 

PanSeek

t.me/dailypanseek
Всефорумный модератор
899
1,745
Люди, хелп. Я чёт сделал, и у меня появляется мышка при запуске игры

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)
local main_1 = imgui.ImBool(false)
local main_2 = imgui.ImBool(false)
local main_3 = imgui.ImBool(false)
local main_4 = imgui.ImBool(false)
local main_5 = imgui.ImBool(false)
local main_6 = imgui.ImBool(false)
local main_7 = imgui.ImBool(false)
local main_8 = imgui.ImBool(false)
local main_9 = imgui.ImBool(false)
local main_10 = imgui.ImBool(false)




-- Main's --

local inicfg = require 'inicfg'
local cfg = inicfg.load({
    Settings = {
        input = "",
                input2 = "",
                input3 = "",
                input4 = "",
                input5 = "",
                input6 = "",
                input7 = "",
                input8 = "",
                input9 = "",
                input10 = ""
    }
}, 'config')

local text_buffer = imgui.ImBuffer(u8(cfg.Settings.input), 10000)
local buffer = imgui.ImBuffer(u8(cfg.Settings.input2), 10000)
local buffer_text = imgui.ImBuffer(u8(cfg.Settings.input3), 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

        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)

        sampRegisterChatCommand("nh", function()
          goKeyPressed(114)
        end)

        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 or main_1 or main_2 or main_3 or main_4 or main_5 or main_6 or main_7 or main_8 or main_9 or main_10

            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 or main_1 or main_2 or main_3 or main_4 or main_5 or main_6 or main_7 or main_8 or main_9 or main_10 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 and not main_1 and not main_2 and not main_3 and not main_4 and not main_5 and not main_6 and not main_7 and not main_8 and not main_9 and not main_10 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_nine.v = not main_nine.v
        end

        if imgui.Button(u8'Сдача П.Р.О и Устава', imgui.ImVec2(800,30)) then
            main_menu.v = false
            main_ten.v = not main_ten.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(" ")
        imgui.Text(" ")
        if imgui.Button(u8'Закрыть', imgui.ImVec2(800,30)) then
            main_menu.v = false
        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(1300, 550)) then
            cfg.Settings.input2 = u8:decode(buffer.v)
            inicfg.save(cfg, 'config')
        end

        if imgui.Button(u8'Назад', imgui.ImVec2(1100,25)) then
            main_nine.v = not main_nine.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_four.v = not main_four.v
                main_six.v = false
            end

            imgui.End()
        end

            -- Main Seven --

            if main_seven.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_seven, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.InputTextMultiline(u8"", buffer_text, imgui.ImVec2(1100, 550)) then
                    cfg.Settings.input3 = u8:decode(buffer_text.v)
                    inicfg.save(cfg, 'config')
                end

                if imgui.Button(u8'Назад', imgui.ImVec2(1100,25)) then
                    main_nine.v = not main_nine.v
                    main_seven.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(" ")
            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_eight.v = false
            end

            imgui.End()
        end

            -- Main nine --

            if main_nine.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_nine, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.Button(u8'Правила редактирования объявлений', imgui.ImVec2(800, 30)) then
                    main_three.v = not main_three.v
                    main_nine.v = false
                end

                if imgui.Button(u8'Правила проведения эфиров', imgui.ImVec2(800, 30)) then
                    main_seven.v = not main_seven.v
                    main_nine.v = false
                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(" ")
                imgui.Text(" ")
                imgui.Text(" ")
                if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                    main_menu.v = not main_menu.v
                    main_nine.v = false
                end

                imgui.End()
            end

            -- Main Ten --

            if main_ten.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_ten, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.Button(u8'Вступление', imgui.ImVec2(800,30)) then
                    main_ten.v = false
                    main_1.v = not main_1.v
                end

                if imgui.Button(u8'Сдача П.Р.О', imgui.ImVec2(800,30)) then
                    main_ten.v = false
                    main_2.v = not main_2.v
                end

                if imgui.Button(u8'Сдача устава', imgui.ImVec2(800,30)) then
                    main_ten.v = false
                    main_3.v = not main_3.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_ten.v = false
                end

                imgui.End()
            end

            -- Main_1 --

            if main_1.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_1, 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
                     end)
                end

                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
                     end)
                end

                if imgui.Button(u8'Листочек', imgui.ImVec2(800, 30)) then
                    local arr = {"/me лёгким движением правой руки, открыл бордачёк стола", "/do Бордачёк открыт.", "/me достал листочек  из бордачка, затем положил на стол", "/do Процесс.", "/do Ручка находится рядом с листочком.", "/b Ответ в /do", "Ответ в /do", "Бери ручку и листочек, мы приступим."}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                     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(" ")
                imgui.Text(" ")
                imgui.Text(" ")
                imgui.Text(" ")
                imgui.Text(" ")
                if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                    main_ten.v = not main_ten.v
                    main_1.v = false
                end

                imgui.End()
            end

            -- Main_2 --

            if main_2.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_2, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.Button(u8'1.1 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.1 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'1.2 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.2 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.3 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.3 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.4 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.4 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.5 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.5 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.6 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.6 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.7 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.7 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.8 П.Р.О', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.8 П.Р.О"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     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(" ")
                if imgui.Button(u8'Назад', imgui.ImVec2(800,30)) then
                    main_ten.v = not main_ten.v
                    main_2.v = false
                end

                imgui.End()
            end

            -- Main_3 --

            if main_3.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_3, imgui.WindowFlags.NoResize + imgui.WindowFlags.ShowBorders + imgui.WindowFlags.NoCollapse)

                if imgui.Button(u8'1.1 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.1 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'1.2 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.2 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.3 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.3 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.4 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.4 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.5 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.5 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.6 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.6 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.7 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.7 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end
                if imgui.Button(u8'1.8 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.8 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'1.9 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 1.9 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.1 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.1 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.2 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.2 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.3 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.3 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.4 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.4 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.5 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.5 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.6 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.6 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'2.7 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 2.7 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'3.1 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 3.1 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'3.2 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 3.2 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'3.3 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 3.3 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'4.1 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 4.1 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'4.2 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 4.2 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

                if imgui.Button(u8'4.3 Устав', imgui.ImVec2(800, 30)) then
                    local arr = {"Зачитай мне 4.3 Устав"}
                    lua_thread.create(function()
                            for k, v in ipairs(arr) do
                                    sampSendChat(v)
                                    wait(2000)
                            end
                            sampSetChatInputEnabled(true)
                     end)
                end

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

                imgui.End()
            end
end
Я же тебе кидал нормальный код. Что за куча ненужных переменных вместо одной и где можно использовать цикл вместо быдлокода. Зря видимо переписывал скрипт, никому это не надо.
 
  • Грустно
Реакции: paulohardy и darkjer

Corrygаn

Участник
225
6
Флудер:
local inicfg = require "inicfg"
local direct = 'moonloader\\settings.ini'
local cfg = inicfg.load({}, "settings")

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

    if not doesFileExist("moonloader/settings.ini") then
        if inicfg.save(settings, "settings.ini") then
            sampAddChatMessage("Исходный конфиг не был найден, поэтому скрипт создал его автоматически.")
        end
    end

    sampRegisterChatCommand("cm",cmd_cm)

    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

--imgui.OnDrawFrame()
            imgui.PushItemWidth(500)
            imgui.InputText(u8"Первая строка", text_buffer1)
            imgui.SameLine()
            imgui.PushItemWidth(100)
            imgui.InputText(u8"Задержка", text_zader1)
            imgui.SetCursorPosX((imgui.GetWindowWidth() - 500) / 10)
            imgui.PushItemWidth(500)
            imgui.InputText(u8"Вторая строка", text_buffer2)
            imgui.SameLine()
            imgui.PushItemWidth(100)
            imgui.InputText(u8"Задержка ", text_zader2)
            imgui.SetCursorPosX((imgui.GetWindowWidth() - 500) / 10)
            imgui.PushItemWidth(500)
            imgui.InputText(u8"Третья строка", text_buffer3)
            imgui.SameLine()
            imgui.PushItemWidth(100)
            imgui.InputText(u8"Задержка  ", text_zader3)
            if imgui.Button("Start flood", imgui.ImVec2(210, 40)) then
                cfg.stproflood = text_buffer1.v
                cfg.ndproflood = text_buffer2.v
                cfg.rdproflood = text_buffer3.v
                inicfg.save(cfg, 'flood_cfg')
                sampAddChatMessage("[Central Market Helper]: " .. white_colour .. "Флудер активирован.", 0x256F60)
                stproflood = true
                ndproflood = true
                rdproflood = true
            end
            imgui.SameLine()
            imgui.BeginChild("propusk", imgui.ImVec2(13, 40), false)
            imgui.EndChild()
            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

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
Хотел сделать чтобы при нажатии на кнопку "Start flood" начинался флуд+сохранялся текст в text_buffer1/2/3 в ini. Флудер работает идеально, но файл ini не создается и соответственно не сохраняется.
 

Nelit

Потрачен
252
38
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Флудер:
local inicfg = require "inicfg"
local direct = 'moonloader\\settings.ini'
local cfg = inicfg.load({}, "settings")

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

    if not doesFileExist("moonloader/settings.ini") then
        if inicfg.save(settings, "settings.ini") then
            sampAddChatMessage("Исходный конфиг не был найден, поэтому скрипт создал его автоматически.")
        end
    end

    sampRegisterChatCommand("cm",cmd_cm)

    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

--imgui.OnDrawFrame()
            imgui.PushItemWidth(500)
            imgui.InputText(u8"Первая строка", text_buffer1)
            imgui.SameLine()
            imgui.PushItemWidth(100)
            imgui.InputText(u8"Задержка", text_zader1)
            imgui.SetCursorPosX((imgui.GetWindowWidth() - 500) / 10)
            imgui.PushItemWidth(500)
            imgui.InputText(u8"Вторая строка", text_buffer2)
            imgui.SameLine()
            imgui.PushItemWidth(100)
            imgui.InputText(u8"Задержка ", text_zader2)
            imgui.SetCursorPosX((imgui.GetWindowWidth() - 500) / 10)
            imgui.PushItemWidth(500)
            imgui.InputText(u8"Третья строка", text_buffer3)
            imgui.SameLine()
            imgui.PushItemWidth(100)
            imgui.InputText(u8"Задержка  ", text_zader3)
            if imgui.Button("Start flood", imgui.ImVec2(210, 40)) then
                cfg.stproflood = text_buffer1.v
                cfg.ndproflood = text_buffer2.v
                cfg.rdproflood = text_buffer3.v
                inicfg.save(cfg, 'flood_cfg')
                sampAddChatMessage("[Central Market Helper]: " .. white_colour .. "Флудер активирован.", 0x256F60)
                stproflood = true
                ndproflood = true
                rdproflood = true
            end
            imgui.SameLine()
            imgui.BeginChild("propusk", imgui.ImVec2(13, 40), false)
            imgui.EndChild()
            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

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
Хотел сделать чтобы при нажатии на кнопку "Start flood" начинался флуд+сохранялся текст в text_buffer1/2/3 в ini. Флудер работает идеально, но файл ini не создается и соответственно не сохраняется.
У тебя нету в коде функции что создаёт файлик. У тебя функция проверяет есть ли файл, затем сохраняет в этот несуществующий файл что-то.
 

Nelit

Потрачен
252
38
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
У меня есть допустим текст "Вы заработали 85000$". Как мне взять эти 85000 и записать в переменную??
 

Nelit

Потрачен
252
38
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.