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

#SameLine

Активный
421
38
как сделать что бы при вводе /b !, выводило в чат /b откат, код простой, даже очень, но потерял его
 

EclipsedFlow

Известный
Проверенный
1,047
476
как сделать что бы при вводе /b !, выводило в чат /b откат, код простой, даже очень, но потерял его
Lua:
-- Писал не через редактор
function main()
    repeat wait(0) until isSampAvailable()
   
    sampRegisterChatCommand('b', function()
        sampSendChat('/b откат')
    end)
   
    while true do wait(0)
    end
end
 

tsunamiqq

Участник
433
17
Как сделать выбор темы через такое меню
1636749324711.png
, вот код, и как сделать разные темы в одномскрипте,без отдельного файла для стилей
Lua:
script_name('FamilyHelper v.1.0')
script_author('Lycorn')
script_description('FamilyHelper')
script_version('1.0')
require "lib.moonloader"
local imgui = require 'imgui'
local key = require 'vkeys'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
cp1251 = encoding.CP1251
local inicfg = require 'inicfg'
local directIni = 'moonloader\\config\\famhelper by lycorn.ini'
local mainIni = inicfg.load(nil, directIni)
local act = 0
--local stateIni = inicfg.save(mainIni, directIni)
local status = inicfg.load(mainIni, directIni)
local mainIni = inicfg.load({
    config = {
        vr=false,
        fam=false,
        j=false,
        ad=false,
        vr_text='',
        fam_text='',
        j_text='',
        ad_text='',
        vr_delay=60000,
        fam_delay=60000,
        j_delay=60000,
    }
}, "famhelper by lycorn")
inicfg.save(mainIni, 'famhelper by lycorn.ini')

local vr_delay = imgui.ImInt(mainIni.config.vr_delay / 60000)
local fam_delay = imgui.ImInt(mainIni.config.fam_delay / 60000)
local j_delay = imgui.ImInt(mainIni.config.j_delay / 60000)
local ad_delay = imgui.ImInt(mainIni.config.ad_delay / 60000)
local text_vr = imgui.ImBuffer(256)
local text_fam = imgui.ImBuffer(256)
local text_j = imgui.ImBuffer(256)
local text_ad = imgui.ImBuffer(256)
local vr = imgui.ImBool(mainIni.config.vr)
local fam = imgui.ImBool(mainIni.config.fam)
local j = imgui.ImBool(mainIni.config.j)
local ad = imgui.ImBool(mainIni.config.ad)
local checked1 = imgui.ImBool(false)
local checked2 = imgui.ImBool(false)
local checked3 = imgui.ImBool(false)
local checked4 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local checkbox = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-1, 0)
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Family Helper v 1.0', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.BeginChild('##tabs', imgui.ImVec2(200, 460), true)
        if imgui.Button('Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button('АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button('Управление\nУчастниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button('          Меню\nЛидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        imgui.EndChild()
        imgui.SameLine()
        if act == 0 then
            imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(300)
            if imgui.Checkbox('/vr', vr) then
                mainIni.config.vr = vr.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/fam', fam) then
                mainIni.config.fam = fam.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/ad', ad) then
                mainIni.config.ad = ad.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/j', j) then
                mainIni.config.j = j.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.Separator()
            if vr.v then
                if imgui.InputText('Введите текст для /vr', text_vr, main_window_state) then
                    mainIni.config.vr_text = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##1', vr_delay, 1,60, main_window_state) then
                    mainIni.config.vr_delay = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if fam.v then
                if imgui.InputText('Введите текст для /fam', text_fam, main_window_state) then
                    mainIni.config.fam_text = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##2', fam_delay, 1,60, main_window_state) then
                    mainIni.config.fam_delay = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if j.v then
                if imgui.InputText('Введите текст для /j', text_j, main_window_state) then
                    mainIni.config.j_text = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##3', j_delay, 1,60, main_window_state) then
                    mainIni.config.j_delay = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if ad.v then
                if imgui.InputText('Введите текст для /ad', text_ad, main_window_state) then
                    mainIni.config.ad_text = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##4', ad_delay, 1,60, main_window_state) then
                    mainIni.config.ad_delay = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        end
    end
    imgui.End()
end

function piar()
    autopiar = not autopiar
    if autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar включен!', 0x00BFFF)
    end
    lua_thread.create(function()
        if vr.v then
            if autopiar then
                sampSendChat('/vr '..mainIni.config.vr_text)
                wait(mainIni.config.vr_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if ad.v then
            if autopiar then
                sampSendChat('/ad '..mainIni.config.ad_text)
                wait(mainIni.config.ad_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if fam.v then
            if autopiar then
                sampSendChat('/fam '..mainIni.config.fam_text)
                wait(mainIni.config.fam_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if j.v then
            if autopiar then
                sampSendChat('/j '..mainIni.config.j_text)
                wait(mainIni.config.j_delay)
                return true
            end
        end
    end)
    if not autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar выключен!', 0x00BFFF)
    end
end

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(2000) end
    sampAddChatMessage(u8:decode'[FamHelper] Автор скрипта - lycorn', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Версия скрипта - 1.0', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Активация хелпера /famh', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] По всем вопросам пишите в ВК - @lycorn.maks', 0x00BFFF)
    sampRegisterChatCommand('famh', function() main_window_state.v = not main_window_state.v end)
    sampRegisterChatCommand('fpiar', piar)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
        if checkbox.v then
            printStringNow('test', 1000)
        end
    end
end

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

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 0.78)
    colors[clr.TextDisabled]         = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.11, 0.15, 0.17, 1.00)
    colors[clr.ChildWindowBg]        = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.FrameBgHovered]       = ImVec4(0.12, 0.20, 0.28, 1.00)
    colors[clr.FrameBgActive]        = ImVec4(0.09, 0.12, 0.14, 1.00)
    colors[clr.TitleBg]              = ImVec4(0.53, 0.20, 0.16, 0.65)
    colors[clr.TitleBgActive]        = ImVec4(0.56, 0.14, 0.14, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg]            = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.ScrollbarBg]          = ImVec4(0.02, 0.02, 0.02, 0.39)
    colors[clr.ScrollbarGrab]        = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
    colors[clr.ScrollbarGrabActive]  = ImVec4(0.09, 0.21, 0.31, 1.00)
    colors[clr.ComboBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.CheckMark]            = ImVec4(1.00, 0.28, 0.28, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.64, 0.14, 0.14, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(1.00, 0.37, 0.37, 1.00)
    colors[clr.Button]               = ImVec4(0.59, 0.13, 0.13, 1.00)
    colors[clr.ButtonHovered]        = ImVec4(0.69, 0.15, 0.15, 1.00)
    colors[clr.ButtonActive]         = ImVec4(0.67, 0.13, 0.07, 1.00)
    colors[clr.Header]               = ImVec4(0.20, 0.25, 0.29, 0.55)
    colors[clr.HeaderHovered]        = ImVec4(0.98, 0.38, 0.26, 0.80)
    colors[clr.HeaderActive]         = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Separator]            = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.SeparatorHovered]     = ImVec4(0.60, 0.60, 0.70, 1.00)
    colors[clr.SeparatorActive]      = ImVec4(0.70, 0.70, 0.90, 1.00)
    colors[clr.ResizeGrip]           = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]    = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]     = ImVec4(0.06, 0.05, 0.07, 1.00)
    colors[clr.CloseButton]          = ImVec4(0.40, 0.39, 0.38, 0.16)
    colors[clr.CloseButtonHovered]   = ImVec4(0.40, 0.39, 0.38, 0.39)
    colors[clr.CloseButtonActive]    = ImVec4(0.40, 0.39, 0.38, 1.00)
    colors[clr.PlotLines]            = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]     = ImVec4(1.00, 0.43, 0.35, 1.00)
    colors[clr.PlotHistogram]        = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
    colors[clr.TextSelectedBg]       = ImVec4(0.25, 1.00, 0.00, 0.43)
    colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
apply_custom_style()
 

Pashyka

Участник
220
17
Как сделать выбор темы через такое меню Посмотреть вложение 122042, вот код, и как сделать разные темы в одномскрипте,без отдельного файла для стилей
Lua:
script_name('FamilyHelper v.1.0')
script_author('Lycorn')
script_description('FamilyHelper')
script_version('1.0')
require "lib.moonloader"
local imgui = require 'imgui'
local key = require 'vkeys'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
cp1251 = encoding.CP1251
local inicfg = require 'inicfg'
local directIni = 'moonloader\\config\\famhelper by lycorn.ini'
local mainIni = inicfg.load(nil, directIni)
local act = 0
--local stateIni = inicfg.save(mainIni, directIni)
local status = inicfg.load(mainIni, directIni)
local mainIni = inicfg.load({
    config = {
        vr=false,
        fam=false,
        j=false,
        ad=false,
        vr_text='',
        fam_text='',
        j_text='',
        ad_text='',
        vr_delay=60000,
        fam_delay=60000,
        j_delay=60000,
    }
}, "famhelper by lycorn")
inicfg.save(mainIni, 'famhelper by lycorn.ini')

local vr_delay = imgui.ImInt(mainIni.config.vr_delay / 60000)
local fam_delay = imgui.ImInt(mainIni.config.fam_delay / 60000)
local j_delay = imgui.ImInt(mainIni.config.j_delay / 60000)
local ad_delay = imgui.ImInt(mainIni.config.ad_delay / 60000)
local text_vr = imgui.ImBuffer(256)
local text_fam = imgui.ImBuffer(256)
local text_j = imgui.ImBuffer(256)
local text_ad = imgui.ImBuffer(256)
local vr = imgui.ImBool(mainIni.config.vr)
local fam = imgui.ImBool(mainIni.config.fam)
local j = imgui.ImBool(mainIni.config.j)
local ad = imgui.ImBool(mainIni.config.ad)
local checked1 = imgui.ImBool(false)
local checked2 = imgui.ImBool(false)
local checked3 = imgui.ImBool(false)
local checked4 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local checkbox = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-1, 0)
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Family Helper v 1.0', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.BeginChild('##tabs', imgui.ImVec2(200, 460), true)
        if imgui.Button('Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button('АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button('Управление\nУчастниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button('          Меню\nЛидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        imgui.EndChild()
        imgui.SameLine()
        if act == 0 then
            imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(300)
            if imgui.Checkbox('/vr', vr) then
                mainIni.config.vr = vr.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/fam', fam) then
                mainIni.config.fam = fam.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/ad', ad) then
                mainIni.config.ad = ad.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/j', j) then
                mainIni.config.j = j.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.Separator()
            if vr.v then
                if imgui.InputText('Введите текст для /vr', text_vr, main_window_state) then
                    mainIni.config.vr_text = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##1', vr_delay, 1,60, main_window_state) then
                    mainIni.config.vr_delay = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if fam.v then
                if imgui.InputText('Введите текст для /fam', text_fam, main_window_state) then
                    mainIni.config.fam_text = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##2', fam_delay, 1,60, main_window_state) then
                    mainIni.config.fam_delay = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if j.v then
                if imgui.InputText('Введите текст для /j', text_j, main_window_state) then
                    mainIni.config.j_text = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##3', j_delay, 1,60, main_window_state) then
                    mainIni.config.j_delay = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if ad.v then
                if imgui.InputText('Введите текст для /ad', text_ad, main_window_state) then
                    mainIni.config.ad_text = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##4', ad_delay, 1,60, main_window_state) then
                    mainIni.config.ad_delay = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        end
    end
    imgui.End()
end

function piar()
    autopiar = not autopiar
    if autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar включен!', 0x00BFFF)
    end
    lua_thread.create(function()
        if vr.v then
            if autopiar then
                sampSendChat('/vr '..mainIni.config.vr_text)
                wait(mainIni.config.vr_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if ad.v then
            if autopiar then
                sampSendChat('/ad '..mainIni.config.ad_text)
                wait(mainIni.config.ad_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if fam.v then
            if autopiar then
                sampSendChat('/fam '..mainIni.config.fam_text)
                wait(mainIni.config.fam_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if j.v then
            if autopiar then
                sampSendChat('/j '..mainIni.config.j_text)
                wait(mainIni.config.j_delay)
                return true
            end
        end
    end)
    if not autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar выключен!', 0x00BFFF)
    end
end

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(2000) end
    sampAddChatMessage(u8:decode'[FamHelper] Автор скрипта - lycorn', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Версия скрипта - 1.0', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Активация хелпера /famh', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] По всем вопросам пишите в ВК - @lycorn.maks', 0x00BFFF)
    sampRegisterChatCommand('famh', function() main_window_state.v = not main_window_state.v end)
    sampRegisterChatCommand('fpiar', piar)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
        if checkbox.v then
            printStringNow('test', 1000)
        end
    end
end

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

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 0.78)
    colors[clr.TextDisabled]         = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.11, 0.15, 0.17, 1.00)
    colors[clr.ChildWindowBg]        = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.FrameBgHovered]       = ImVec4(0.12, 0.20, 0.28, 1.00)
    colors[clr.FrameBgActive]        = ImVec4(0.09, 0.12, 0.14, 1.00)
    colors[clr.TitleBg]              = ImVec4(0.53, 0.20, 0.16, 0.65)
    colors[clr.TitleBgActive]        = ImVec4(0.56, 0.14, 0.14, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg]            = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.ScrollbarBg]          = ImVec4(0.02, 0.02, 0.02, 0.39)
    colors[clr.ScrollbarGrab]        = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
    colors[clr.ScrollbarGrabActive]  = ImVec4(0.09, 0.21, 0.31, 1.00)
    colors[clr.ComboBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.CheckMark]            = ImVec4(1.00, 0.28, 0.28, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.64, 0.14, 0.14, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(1.00, 0.37, 0.37, 1.00)
    colors[clr.Button]               = ImVec4(0.59, 0.13, 0.13, 1.00)
    colors[clr.ButtonHovered]        = ImVec4(0.69, 0.15, 0.15, 1.00)
    colors[clr.ButtonActive]         = ImVec4(0.67, 0.13, 0.07, 1.00)
    colors[clr.Header]               = ImVec4(0.20, 0.25, 0.29, 0.55)
    colors[clr.HeaderHovered]        = ImVec4(0.98, 0.38, 0.26, 0.80)
    colors[clr.HeaderActive]         = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Separator]            = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.SeparatorHovered]     = ImVec4(0.60, 0.60, 0.70, 1.00)
    colors[clr.SeparatorActive]      = ImVec4(0.70, 0.70, 0.90, 1.00)
    colors[clr.ResizeGrip]           = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]    = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]     = ImVec4(0.06, 0.05, 0.07, 1.00)
    colors[clr.CloseButton]          = ImVec4(0.40, 0.39, 0.38, 0.16)
    colors[clr.CloseButtonHovered]   = ImVec4(0.40, 0.39, 0.38, 0.39)
    colors[clr.CloseButtonActive]    = ImVec4(0.40, 0.39, 0.38, 1.00)
    colors[clr.PlotLines]            = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]     = ImVec4(1.00, 0.43, 0.35, 1.00)
    colors[clr.PlotHistogram]        = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
    colors[clr.TextSelectedBg]       = ImVec4(0.25, 1.00, 0.00, 0.43)
    colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
apply_custom_style()
Lua:
selected_item = imgui.ImInt(0)

if imgui.Combo(u8'ComboBox', selected_item, {'1', '2', '3', '4'}, 4) then
  if selected_item.v == 0 then
    sampAddChatMessage('1', -1)
  end
    if selected_item.v == 1 then
        sampAddChatMessage('2', -1)
    end
    if selected_item.v == 2 then
        sampAddChatMessage('3', -1)
    end
    if selected_item.v == 3 then
        sampAddChatMessage('4', -1)
    end
end

{'1', '2', '3', '4'} - названия элементов
 

tsunamiqq

Участник
433
17
Lua:
selected_item = imgui.ImInt(0)

if imgui.Combo(u8'ComboBox', selected_item, {'1', '2', '3', '4'}, 4) then
  if selected_item.v == 0 then
    sampAddChatMessage('1', -1)
  end
    if selected_item.v == 1 then
        sampAddChatMessage('2', -1)
    end
    if selected_item.v == 2 then
        sampAddChatMessage('3', -1)
    end
    if selected_item.v == 3 then
        sampAddChatMessage('4', -1)
    end
end

{'1', '2', '3', '4'} - названия элементов
спасибо, а как сделать разные стили тип в один скрипт? и выбор их через комбо
 

Pashyka

Участник
220
17
спасибо, а как сделать разные стили тип в один скрипт? и выбор их через комбо

Например RedTheme(), BlueTheme(), BlackTheme()


Lua:
selected_item = imgui.ImInt(0)

if imgui.Combo(u8'ComboBox', selected_item, {'Красная тема', 'Синяя тема', 'Черная тема'}, 3) then
    if selected_item.v == 0 then
        RedTheme()
    end
    if selected_item.v == 1 then
        BlueTheme()
    end
    if selected_item.v == 2 then
        BlackTheme()
    end
end
 
Последнее редактирование:

tsunamiqq

Участник
433
17
Доброй ночи, решил в сниппетах покопаться, и нашел такую интересную функцию от Cosmo, как подсказки, вставляю в код, как навожу на подсказку скрипт моментально крашит с ошибкой:

Код:
[23:30:06.669369] (error)    Media Helper: ...mes\ARIZONA GAMES\bin\Arizona\moonloader\MediaHelper.lua:521: attempt to call field 'PushStyleVarFloat' (a nil value)
stack traceback:
    ...mes\ARIZONA GAMES\bin\Arizona\moonloader\MediaHelper.lua:521: in function 'Hint'
    ...mes\ARIZONA GAMES\bin\Arizona\moonloader\MediaHelper.lua:275: in function 'OnDrawFrame'
    C:\Games\ARIZONA GAMES\bin\Arizona\moonloader\lib\imgui.lua:1379: in function <C:\Games\ARIZONA GAMES\bin\Arizona\moonloader\lib\imgui.lua:1368>
[23:30:06.670369] (error)    Media Helper: Script died due to an error. (3569FE34)

Ниже представлен код:

Lua:
function imgui.Hint(str_id, hint, delay)
    local hovered = imgui.IsItemHovered()
    local animTime = 0.2
    local delay = delay or 0.00
    local show = true

    if not allHints then allHints = {} end
    if not allHints[str_id] then
        allHints[str_id] = {
            status = false,
            timer = 0
        }
    end

    if hovered then
        for k, v in pairs(allHints) do
            if k ~= str_id and os.clock() - v.timer <= animTime  then
                show = false
            end
        end
    end

    if show and allHints[str_id].status ~= hovered then
        allHints[str_id].status = hovered
        allHints[str_id].timer = os.clock() + delay
    end

    if show then
        local between = os.clock() - allHints[str_id].timer
        if between <= animTime then
            local s = function(f)
                return f < 0.0 and 0.0 or (f > 1.0 and 1.0 or f)
            end
            local alpha = hovered and s(between / animTime) or s(1.00 - between / animTime)
            imgui.PushStyleVarFloat(imgui.StyleVar.Alpha, alpha)
            imgui.SetTooltip(hint)
            imgui.PopStyleVar()
        elseif hovered then
            imgui.SetTooltip(hint)
        end
    end
end

Ошибка возникает на строчке 521(Скрин)
Посмотреть вложение 122046

@Cosmo помоги, в чем проблема, ты больше понимаешь в своей функции)) МБ библиотеки не хватает, не уверен точно(



Например RedTheme(), BlueTheme(), BlackTheme()


Lua:
selected_item = imgui.ImInt(0)

if imgui.Combo(u8'ComboBox', selected_item, {'Красная тема', 'Синяя тема', 'Черная тема'}, 3) then
      if selected_item.v == 0 then
           RedTheme()
      end
    if selected_item.v == 1 then
        BlueTheme()
    end
    if selected_item.v == 2 then
        BlackTheme()
    end
end
спасибо
 

Pashyka

Участник
220
17
Доброй ночи, решил в сниппетах покопаться, и нашел такую интересную функцию от Cosmo, как подсказки, вставляю в код, как навожу на подсказку скрипт моментально крашит с ошибкой:

Код:
[23:30:06.669369] (error)    Media Helper: ...mes\ARIZONA GAMES\bin\Arizona\moonloader\MediaHelper.lua:521: attempt to call field 'PushStyleVarFloat' (a nil value)
stack traceback:
    ...mes\ARIZONA GAMES\bin\Arizona\moonloader\MediaHelper.lua:521: in function 'Hint'
    ...mes\ARIZONA GAMES\bin\Arizona\moonloader\MediaHelper.lua:275: in function 'OnDrawFrame'
    C:\Games\ARIZONA GAMES\bin\Arizona\moonloader\lib\imgui.lua:1379: in function <C:\Games\ARIZONA GAMES\bin\Arizona\moonloader\lib\imgui.lua:1368>
[23:30:06.670369] (error)    Media Helper: Script died due to an error. (3569FE34)

Ниже представлен код:

Lua:
function imgui.Hint(str_id, hint, delay)
    local hovered = imgui.IsItemHovered()
    local animTime = 0.2
    local delay = delay or 0.00
    local show = true

    if not allHints then allHints = {} end
    if not allHints[str_id] then
        allHints[str_id] = {
            status = false,
            timer = 0
        }
    end

    if hovered then
        for k, v in pairs(allHints) do
            if k ~= str_id and os.clock() - v.timer <= animTime  then
                show = false
            end
        end
    end

    if show and allHints[str_id].status ~= hovered then
        allHints[str_id].status = hovered
        allHints[str_id].timer = os.clock() + delay
    end

    if show then
        local between = os.clock() - allHints[str_id].timer
        if between <= animTime then
            local s = function(f)
                return f < 0.0 and 0.0 or (f > 1.0 and 1.0 or f)
            end
            local alpha = hovered and s(between / animTime) or s(1.00 - between / animTime)
            imgui.PushStyleVarFloat(imgui.StyleVar.Alpha, alpha)
            imgui.SetTooltip(hint)
            imgui.PopStyleVar()
        elseif hovered then
            imgui.SetTooltip(hint)
        end
    end
end

Ошибка возникает на строчке 521(Скрин)
1636750935385.png


@Cosmo помоги, в чем проблема, ты больше понимаешь в своей функции)) МБ библиотеки не хватает, не уверен точно(
 

tsunamiqq

Участник
433
17
Например RedTheme(), BlueTheme(), BlackTheme()


Lua:
selected_item = imgui.ImInt(0)

if imgui.Combo(u8'ComboBox', selected_item, {'Красная тема', 'Синяя тема', 'Черная тема'}, 3) then
    if selected_item.v == 0 then
        RedTheme()
    end
    if selected_item.v == 1 then
        BlueTheme()
    end
    if selected_item.v == 2 then
        BlackTheme()
    end
end
Если не сложно, можешь сделать плз 2 темы, я прост не сильно понял как делать.
Lua:
script_name('FamilyHelper v.1.0')
script_author('Lycorn')
script_description('FamilyHelper')
script_version('1.0')
require "lib.moonloader"
local imgui = require 'imgui'
local key = require 'vkeys'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
cp1251 = encoding.CP1251
local inicfg = require 'inicfg'
local directIni = 'moonloader\\config\\famhelper by lycorn.ini'
local mainIni = inicfg.load(nil, directIni)
local act = 0
--local stateIni = inicfg.save(mainIni, directIni)
local status = inicfg.load(mainIni, directIni)
local mainIni = inicfg.load({
    config = {
        vr=false,
        fam=false,
        j=false,
        ad=false,
        vr_text='',
        fam_text='',
        j_text='',
        ad_text='',
        vr_delay=60000,
        fam_delay=60000,
        j_delay=60000,
    }
}, "famhelper by lycorn")
inicfg.save(mainIni, 'famhelper by lycorn.ini')

local selected_item = imgui.ImInt(0)
local vr_delay = imgui.ImInt(mainIni.config.vr_delay / 60000)
local fam_delay = imgui.ImInt(mainIni.config.fam_delay / 60000)
local j_delay = imgui.ImInt(mainIni.config.j_delay / 60000)
local ad_delay = imgui.ImInt(mainIni.config.ad_delay / 60000)
local text_vr = imgui.ImBuffer(256)
local text_fam = imgui.ImBuffer(256)
local text_j = imgui.ImBuffer(256)
local text_ad = imgui.ImBuffer(256)
local vr = imgui.ImBool(mainIni.config.vr)
local fam = imgui.ImBool(mainIni.config.fam)
local j = imgui.ImBool(mainIni.config.j)
local ad = imgui.ImBool(mainIni.config.ad)
local checked1 = imgui.ImBool(false)
local checked2 = imgui.ImBool(false)
local checked3 = imgui.ImBool(false)
local checked4 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local checkbox = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-1, 0)
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Family Helper v 1.0', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.BeginChild('##tabs', imgui.ImVec2(200, 460), true)
        if imgui.Button('Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button('АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button('Управление\nУчастниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button('          Меню\nЛидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        imgui.EndChild()
        imgui.SameLine()
        if act == 0 then
            imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
            if imgui.Combo(u8'ComboBox', selected_item, {'1', '2', '3', '4'}, 4) then
                if selected_item.v == 0 then
                  sampAddChatMessage('1', -1)
                end
                  if selected_item.v == 1 then
                      sampAddChatMessage('2', -1)
                  end
                  if selected_item.v == 2 then
                      sampAddChatMessage('3', -1)
                  end
                  if selected_item.v == 3 then
                      sampAddChatMessage('4', -1)
                  end
              end
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(300)
            if imgui.Checkbox('/vr', vr) then
                mainIni.config.vr = vr.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/fam', fam) then
                mainIni.config.fam = fam.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/ad', ad) then
                mainIni.config.ad = ad.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/j', j) then
                mainIni.config.j = j.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.Separator()
            if vr.v then
                if imgui.InputText('Введите текст для /vr', text_vr, main_window_state) then
                    mainIni.config.vr_text = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##1', vr_delay, 1,60, main_window_state) then
                    mainIni.config.vr_delay = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if fam.v then
                if imgui.InputText('Введите текст для /fam', text_fam, main_window_state) then
                    mainIni.config.fam_text = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##2', fam_delay, 1,60, main_window_state) then
                    mainIni.config.fam_delay = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if j.v then
                if imgui.InputText('Введите текст для /j', text_j, main_window_state) then
                    mainIni.config.j_text = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##3', j_delay, 1,60, main_window_state) then
                    mainIni.config.j_delay = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if ad.v then
                if imgui.InputText('Введите текст для /ad', text_ad, main_window_state) then
                    mainIni.config.ad_text = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##4', ad_delay, 1,60, main_window_state) then
                    mainIni.config.ad_delay = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        end
    end
    imgui.End()
end

function piar()
    autopiar = not autopiar
    if autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar включен!', 0x00BFFF)
    end
    lua_thread.create(function()
        if vr.v then
            if autopiar then
                sampSendChat('/vr '..mainIni.config.vr_text)
                wait(mainIni.config.vr_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if ad.v then
            if autopiar then
                sampSendChat('/ad '..mainIni.config.ad_text)
                wait(mainIni.config.ad_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if fam.v then
            if autopiar then
                sampSendChat('/fam '..mainIni.config.fam_text)
                wait(mainIni.config.fam_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if j.v then
            if autopiar then
                sampSendChat('/j '..mainIni.config.j_text)
                wait(mainIni.config.j_delay)
                return true
            end
        end
    end)
    if not autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar выключен!', 0x00BFFF)
    end
end

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(2000) end
    sampAddChatMessage(u8:decode'[FamHelper] Автор скрипта - lycorn', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Версия скрипта - 1.0', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Активация хелпера /famh', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] По всем вопросам пишите в ВК - @lycorn.maks', 0x00BFFF)
    sampRegisterChatCommand('famh', function() main_window_state.v = not main_window_state.v end)
    sampRegisterChatCommand('fpiar', piar)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
        if checkbox.v then
            printStringNow('test', 1000)
        end
    end
end

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

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 0.78)
    colors[clr.TextDisabled]         = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.11, 0.15, 0.17, 1.00)
    colors[clr.ChildWindowBg]        = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.FrameBgHovered]       = ImVec4(0.12, 0.20, 0.28, 1.00)
    colors[clr.FrameBgActive]        = ImVec4(0.09, 0.12, 0.14, 1.00)
    colors[clr.TitleBg]              = ImVec4(0.53, 0.20, 0.16, 0.65)
    colors[clr.TitleBgActive]        = ImVec4(0.56, 0.14, 0.14, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg]            = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.ScrollbarBg]          = ImVec4(0.02, 0.02, 0.02, 0.39)
    colors[clr.ScrollbarGrab]        = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
    colors[clr.ScrollbarGrabActive]  = ImVec4(0.09, 0.21, 0.31, 1.00)
    colors[clr.ComboBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.CheckMark]            = ImVec4(1.00, 0.28, 0.28, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.64, 0.14, 0.14, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(1.00, 0.37, 0.37, 1.00)
    colors[clr.Button]               = ImVec4(0.59, 0.13, 0.13, 1.00)
    colors[clr.ButtonHovered]        = ImVec4(0.69, 0.15, 0.15, 1.00)
    colors[clr.ButtonActive]         = ImVec4(0.67, 0.13, 0.07, 1.00)
    colors[clr.Header]               = ImVec4(0.20, 0.25, 0.29, 0.55)
    colors[clr.HeaderHovered]        = ImVec4(0.98, 0.38, 0.26, 0.80)
    colors[clr.HeaderActive]         = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Separator]            = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.SeparatorHovered]     = ImVec4(0.60, 0.60, 0.70, 1.00)
    colors[clr.SeparatorActive]      = ImVec4(0.70, 0.70, 0.90, 1.00)
    colors[clr.ResizeGrip]           = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]    = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]     = ImVec4(0.06, 0.05, 0.07, 1.00)
    colors[clr.CloseButton]          = ImVec4(0.40, 0.39, 0.38, 0.16)
    colors[clr.CloseButtonHovered]   = ImVec4(0.40, 0.39, 0.38, 0.39)
    colors[clr.CloseButtonActive]    = ImVec4(0.40, 0.39, 0.38, 1.00)
    colors[clr.PlotLines]            = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]     = ImVec4(1.00, 0.43, 0.35, 1.00)
    colors[clr.PlotHistogram]        = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
    colors[clr.TextSelectedBg]       = ImVec4(0.25, 1.00, 0.00, 0.43)
    colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
apply_custom_style()

Вот еще одно тема
Lua:
            colors[clr.FrameBg]                = ImVec4(0.16, 0.29, 0.48, 0.54)
            colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.59, 0.98, 0.40)
            colors[clr.FrameBgActive]          = ImVec4(0.26, 0.59, 0.98, 0.67)
            colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
            colors[clr.TitleBgActive]          = ImVec4(0.16, 0.29, 0.48, 1.00)
            colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
            colors[clr.CheckMark]              = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.SliderGrab]             = ImVec4(0.24, 0.52, 0.88, 1.00)
            colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.Button]                 = ImVec4(0.26, 0.59, 0.98, 0.40)
            colors[clr.ButtonHovered]          = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.ButtonActive]           = ImVec4(0.06, 0.53, 0.98, 1.00)
            colors[clr.Header]                 = ImVec4(0.26, 0.59, 0.98, 0.31)
            colors[clr.HeaderHovered]          = ImVec4(0.26, 0.59, 0.98, 0.80)
            colors[clr.HeaderActive]           = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.Separator]              = colors[clr.Border]
            colors[clr.SeparatorHovered]       = ImVec4(0.26, 0.59, 0.98, 0.78)
            colors[clr.SeparatorActive]        = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.ResizeGrip]             = ImVec4(0.26, 0.59, 0.98, 0.25)
            colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.59, 0.98, 0.67)
            colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.59, 0.98, 0.95)
            colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.35)
            colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00)
            colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00)
            colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 0.94)
            colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
            colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
            colors[clr.ComboBg]                = colors[clr.PopupBg]
            colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 0.50)
            colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)
            colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 1.00)
            colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.53)
            colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 1.00)
            colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 1.00)
            colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 1.00)
            colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 0.50)
            colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 1.00)
            colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 1.00)
            colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00)
            colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.43, 0.35, 1.00)
            colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 1.00)
            colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 1.00)
            colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
 

YarikVL

Известный
Проверенный
4,750
1,815
Если не сложно, можешь сделать плз 2 темы, я прост не сильно понял как делать.
Lua:
script_name('FamilyHelper v.1.0')
script_author('Lycorn')
script_description('FamilyHelper')
script_version('1.0')
require "lib.moonloader"
local imgui = require 'imgui'
local key = require 'vkeys'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
cp1251 = encoding.CP1251
local inicfg = require 'inicfg'
local directIni = 'moonloader\\config\\famhelper by lycorn.ini'
local mainIni = inicfg.load(nil, directIni)
local act = 0
--local stateIni = inicfg.save(mainIni, directIni)
local status = inicfg.load(mainIni, directIni)
local mainIni = inicfg.load({
    config = {
        vr=false,
        fam=false,
        j=false,
        ad=false,
        vr_text='',
        fam_text='',
        j_text='',
        ad_text='',
        vr_delay=60000,
        fam_delay=60000,
        j_delay=60000,
    }
}, "famhelper by lycorn")
inicfg.save(mainIni, 'famhelper by lycorn.ini')

local selected_item = imgui.ImInt(0)
local vr_delay = imgui.ImInt(mainIni.config.vr_delay / 60000)
local fam_delay = imgui.ImInt(mainIni.config.fam_delay / 60000)
local j_delay = imgui.ImInt(mainIni.config.j_delay / 60000)
local ad_delay = imgui.ImInt(mainIni.config.ad_delay / 60000)
local text_vr = imgui.ImBuffer(256)
local text_fam = imgui.ImBuffer(256)
local text_j = imgui.ImBuffer(256)
local text_ad = imgui.ImBuffer(256)
local vr = imgui.ImBool(mainIni.config.vr)
local fam = imgui.ImBool(mainIni.config.fam)
local j = imgui.ImBool(mainIni.config.j)
local ad = imgui.ImBool(mainIni.config.ad)
local checked1 = imgui.ImBool(false)
local checked2 = imgui.ImBool(false)
local checked3 = imgui.ImBool(false)
local checked4 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local checkbox = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-1, 0)
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Family Helper v 1.0', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.BeginChild('##tabs', imgui.ImVec2(200, 460), true)
        if imgui.Button('Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button('АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button('Управление\nУчастниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button('          Меню\nЛидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        imgui.EndChild()
        imgui.SameLine()
        if act == 0 then
            imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
            if imgui.Combo(u8'ComboBox', selected_item, {'1', '2', '3', '4'}, 4) then
                if selected_item.v == 0 then
                  sampAddChatMessage('1', -1)
                end
                  if selected_item.v == 1 then
                      sampAddChatMessage('2', -1)
                  end
                  if selected_item.v == 2 then
                      sampAddChatMessage('3', -1)
                  end
                  if selected_item.v == 3 then
                      sampAddChatMessage('4', -1)
                  end
              end
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(300)
            if imgui.Checkbox('/vr', vr) then
                mainIni.config.vr = vr.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/fam', fam) then
                mainIni.config.fam = fam.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/ad', ad) then
                mainIni.config.ad = ad.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/j', j) then
                mainIni.config.j = j.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.Separator()
            if vr.v then
                if imgui.InputText('Введите текст для /vr', text_vr, main_window_state) then
                    mainIni.config.vr_text = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##1', vr_delay, 1,60, main_window_state) then
                    mainIni.config.vr_delay = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if fam.v then
                if imgui.InputText('Введите текст для /fam', text_fam, main_window_state) then
                    mainIni.config.fam_text = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##2', fam_delay, 1,60, main_window_state) then
                    mainIni.config.fam_delay = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if j.v then
                if imgui.InputText('Введите текст для /j', text_j, main_window_state) then
                    mainIni.config.j_text = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##3', j_delay, 1,60, main_window_state) then
                    mainIni.config.j_delay = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if ad.v then
                if imgui.InputText('Введите текст для /ad', text_ad, main_window_state) then
                    mainIni.config.ad_text = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##4', ad_delay, 1,60, main_window_state) then
                    mainIni.config.ad_delay = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        end
    end
    imgui.End()
end

function piar()
    autopiar = not autopiar
    if autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar включен!', 0x00BFFF)
    end
    lua_thread.create(function()
        if vr.v then
            if autopiar then
                sampSendChat('/vr '..mainIni.config.vr_text)
                wait(mainIni.config.vr_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if ad.v then
            if autopiar then
                sampSendChat('/ad '..mainIni.config.ad_text)
                wait(mainIni.config.ad_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if fam.v then
            if autopiar then
                sampSendChat('/fam '..mainIni.config.fam_text)
                wait(mainIni.config.fam_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if j.v then
            if autopiar then
                sampSendChat('/j '..mainIni.config.j_text)
                wait(mainIni.config.j_delay)
                return true
            end
        end
    end)
    if not autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar выключен!', 0x00BFFF)
    end
end

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(2000) end
    sampAddChatMessage(u8:decode'[FamHelper] Автор скрипта - lycorn', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Версия скрипта - 1.0', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Активация хелпера /famh', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] По всем вопросам пишите в ВК - @lycorn.maks', 0x00BFFF)
    sampRegisterChatCommand('famh', function() main_window_state.v = not main_window_state.v end)
    sampRegisterChatCommand('fpiar', piar)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
        if checkbox.v then
            printStringNow('test', 1000)
        end
    end
end

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

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 0.78)
    colors[clr.TextDisabled]         = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.11, 0.15, 0.17, 1.00)
    colors[clr.ChildWindowBg]        = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.FrameBgHovered]       = ImVec4(0.12, 0.20, 0.28, 1.00)
    colors[clr.FrameBgActive]        = ImVec4(0.09, 0.12, 0.14, 1.00)
    colors[clr.TitleBg]              = ImVec4(0.53, 0.20, 0.16, 0.65)
    colors[clr.TitleBgActive]        = ImVec4(0.56, 0.14, 0.14, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg]            = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.ScrollbarBg]          = ImVec4(0.02, 0.02, 0.02, 0.39)
    colors[clr.ScrollbarGrab]        = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
    colors[clr.ScrollbarGrabActive]  = ImVec4(0.09, 0.21, 0.31, 1.00)
    colors[clr.ComboBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.CheckMark]            = ImVec4(1.00, 0.28, 0.28, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.64, 0.14, 0.14, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(1.00, 0.37, 0.37, 1.00)
    colors[clr.Button]               = ImVec4(0.59, 0.13, 0.13, 1.00)
    colors[clr.ButtonHovered]        = ImVec4(0.69, 0.15, 0.15, 1.00)
    colors[clr.ButtonActive]         = ImVec4(0.67, 0.13, 0.07, 1.00)
    colors[clr.Header]               = ImVec4(0.20, 0.25, 0.29, 0.55)
    colors[clr.HeaderHovered]        = ImVec4(0.98, 0.38, 0.26, 0.80)
    colors[clr.HeaderActive]         = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Separator]            = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.SeparatorHovered]     = ImVec4(0.60, 0.60, 0.70, 1.00)
    colors[clr.SeparatorActive]      = ImVec4(0.70, 0.70, 0.90, 1.00)
    colors[clr.ResizeGrip]           = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]    = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]     = ImVec4(0.06, 0.05, 0.07, 1.00)
    colors[clr.CloseButton]          = ImVec4(0.40, 0.39, 0.38, 0.16)
    colors[clr.CloseButtonHovered]   = ImVec4(0.40, 0.39, 0.38, 0.39)
    colors[clr.CloseButtonActive]    = ImVec4(0.40, 0.39, 0.38, 1.00)
    colors[clr.PlotLines]            = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]     = ImVec4(1.00, 0.43, 0.35, 1.00)
    colors[clr.PlotHistogram]        = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
    colors[clr.TextSelectedBg]       = ImVec4(0.25, 1.00, 0.00, 0.43)
    colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
apply_custom_style()

Вот еще одно тема
Lua:
            colors[clr.FrameBg]                = ImVec4(0.16, 0.29, 0.48, 0.54)
            colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.59, 0.98, 0.40)
            colors[clr.FrameBgActive]          = ImVec4(0.26, 0.59, 0.98, 0.67)
            colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
            colors[clr.TitleBgActive]          = ImVec4(0.16, 0.29, 0.48, 1.00)
            colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
            colors[clr.CheckMark]              = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.SliderGrab]             = ImVec4(0.24, 0.52, 0.88, 1.00)
            colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.Button]                 = ImVec4(0.26, 0.59, 0.98, 0.40)
            colors[clr.ButtonHovered]          = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.ButtonActive]           = ImVec4(0.06, 0.53, 0.98, 1.00)
            colors[clr.Header]                 = ImVec4(0.26, 0.59, 0.98, 0.31)
            colors[clr.HeaderHovered]          = ImVec4(0.26, 0.59, 0.98, 0.80)
            colors[clr.HeaderActive]           = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.Separator]              = colors[clr.Border]
            colors[clr.SeparatorHovered]       = ImVec4(0.26, 0.59, 0.98, 0.78)
            colors[clr.SeparatorActive]        = ImVec4(0.26, 0.59, 0.98, 1.00)
            colors[clr.ResizeGrip]             = ImVec4(0.26, 0.59, 0.98, 0.25)
            colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.59, 0.98, 0.67)
            colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.59, 0.98, 0.95)
            colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.35)
            colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00)
            colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00)
            colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 0.94)
            colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
            colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
            colors[clr.ComboBg]                = colors[clr.PopupBg]
            colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 0.50)
            colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)
            colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 1.00)
            colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.53)
            colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 1.00)
            colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 1.00)
            colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 1.00)
            colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 0.50)
            colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 1.00)
            colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 1.00)
            colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00)
            colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.43, 0.35, 1.00)
            colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 1.00)
            colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 1.00)
            colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
Ну берёшь и каждой теме присваиваешь функцию со своим именем например function BlackTheme()
Ниже вставляешь настройки стиля ( то есть цвета стиля ) и потом как человек показал вызываешь эти функции
 
  • Нравится
Реакции: tsunamiqq

tsunamiqq

Участник
433
17
Ну берёшь и каждой теме присваиваешь функцию со своим именем например function BlackTheme()
Ниже вставляешь настройки стиля ( то есть цвета стиля ) и потом как человек показал вызываешь эти функции
спасибо большое

Как решить эту ошибку
Lua:
88: ')' expected near 'kypill'
Lua:
script_name('FamilyHelper v.1.0')
script_author('Lycorn')
script_description('FamilyHelper')
script_version('1.0')
require "lib.moonloader"
local imgui = require 'imgui'
local key = require 'vkeys'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
cp1251 = encoding.CP1251
local inicfg = require 'inicfg'
local directIni = 'moonloader\\config\\famhelper by lycorn.ini'
local mainIni = inicfg.load(nil, directIni)
local act = 0
--local stateIni = inicfg.save(mainIni, directIni)
local status = inicfg.load(mainIni, directIni)
local mainIni = inicfg.load({
    config = {
        vr=false,
        fam=false,
        j=false,
        ad=false,
        kypill=false,
        vr_text='',
        fam_text='',
        j_text='',
        ad_text='',
        kypillviptext='',
        vr_delay=60000,
        fam_delay=60000,
        j_delay=60000,
    }
}, "famhelper by lycorn")
inicfg.save(mainIni, 'famhelper by lycorn.ini')

local selected_item = imgui.ImInt(0)
local vr_delay = imgui.ImInt(mainIni.config.vr_delay / 60000)
local fam_delay = imgui.ImInt(mainIni.config.fam_delay / 60000)
local j_delay = imgui.ImInt(mainIni.config.j_delay / 60000)
local ad_delay = imgui.ImInt(mainIni.config.ad_delay / 60000)
local text_vr = imgui.ImBuffer(256)
local text_fam = imgui.ImBuffer(256)
local text_j = imgui.ImBuffer(256)
local text_ad = imgui.ImBuffer(256)
local text_vip = imgui.ImBuffer(256)
local vr = imgui.ImBool(mainIni.config.vr)
local fam = imgui.ImBool(mainIni.config.fam)
local j = imgui.ImBool(mainIni.config.j)
local ad = imgui.ImBool(mainIni.config.ad)
local checked1 = imgui.ImBool(false)
local checked2 = imgui.ImBool(false)
local checked3 = imgui.ImBool(false)
local checked4 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local checkbox = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-1, 0)
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Family Helper v 1.0', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.BeginChild('##tabs', imgui.ImVec2(200, 460), true)
        if imgui.Button('Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button('АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button('Управление\nУчастниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button('          Меню\nЛидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        imgui.EndChild()
        imgui.SameLine()
        if act == 0 then
            imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
            if imgui.Combo('Стиль темы', selected_item, {'Красный', 'Синий', 'Монохрон', 'Свётло-Темный'}, 4, main_window_state) then
                if selected_item.v == 0 then
                  RedTheme()
                end
                  if selected_item.v == 1 then
                      BlueTheme()
                  end
                  if selected_item.v == 2 then
                      MonTheme()
                  end
                  if selected_item.v == 3 then
                      SvTmTheme()
                  end
              end
            imgui.Separator()
            if imgui.Checkbox('##kypillvip' kypill) then
                mainIni.config.kypill = kypill.v
                inicfg.save(mainIni, "famhelper by lycorn.ini")
            end
            if kypill.v then
               if imgui.InputText('Текст при покупки VIP', text_vip, main_window_state) then
                mainIni.config.kypillviptext = text_vip.v
                inicfg.save(mainIni, "famhelper by lycorn.ini")
            end
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(300)
            if imgui.Checkbox('/vr', vr) then
                mainIni.config.vr = vr.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/fam', fam) then
                mainIni.config.fam = fam.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/ad', ad) then
                mainIni.config.ad = ad.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/j', j) then
                mainIni.config.j = j.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.Separator()
            if vr.v then
                if imgui.InputText('Введите текст для /vr', text_vr, main_window_state) then
                    mainIni.config.vr_text = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##1', vr_delay, 1,60, main_window_state) then
                    mainIni.config.vr_delay = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if fam.v then
                if imgui.InputText('Введите текст для /fam', text_fam, main_window_state) then
                    mainIni.config.fam_text = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##2', fam_delay, 1,60, main_window_state) then
                    mainIni.config.fam_delay = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if j.v then
                if imgui.InputText('Введите текст для /j', text_j, main_window_state) then
                    mainIni.config.j_text = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##3', j_delay, 1,60, main_window_state) then
                    mainIni.config.j_delay = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if ad.v then
                if imgui.InputText('Введите текст для /ad', text_ad, main_window_state) then
                    mainIni.config.ad_text = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##4', ad_delay, 1,60, main_window_state) then
                    mainIni.config.ad_delay = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        end
    end
    imgui.End()
end

if kypill.v then
    if text:find("приобрел PREMIUM VIP.") or text:find("приобрел Titan VIP.") and not text:find("говорит") and not text:find('- |') then
        sampSendChat("/vr "..mainIni.config.kypillviptext)
        inicfg.save(mainIni, 'famhelper by lycorn.ini')
        end
    end

function piar()
    autopiar = not autopiar
    if autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar включен!', 0x00BFFF)
    end
    lua_thread.create(function()
        if vr.v then
            if autopiar then
                sampSendChat('/vr '..mainIni.config.vr_text)
                wait(mainIni.config.vr_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if ad.v then
            if autopiar then
                sampSendChat('/ad '..mainIni.config.ad_text)
                wait(mainIni.config.ad_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if fam.v then
            if autopiar then
                sampSendChat('/fam '..mainIni.config.fam_text)
                wait(mainIni.config.fam_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if j.v then
            if autopiar then
                sampSendChat('/j '..mainIni.config.j_text)
                wait(mainIni.config.j_delay)
                return true
            end
        end
    end)
    if not autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar выключен!', 0x00BFFF)
    end
end

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(2000) end
    sampAddChatMessage(u8:decode'[FamHelper] Автор скрипта - lycorn', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Версия скрипта - 1.0', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Активация хелпера /famh', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] По всем вопросам пишите в ВК - @lycorn.maks', 0x00BFFF)
    sampRegisterChatCommand('famh', function() main_window_state.v = not main_window_state.v end)
    sampRegisterChatCommand('fpiar', piar)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
        if checkbox.v then
            printStringNow('test', 1000)
        end
    end
end

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

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 0.78)
    colors[clr.TextDisabled]         = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.11, 0.15, 0.17, 1.00)
    colors[clr.ChildWindowBg]        = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.FrameBgHovered]       = ImVec4(0.12, 0.20, 0.28, 1.00)
    colors[clr.FrameBgActive]        = ImVec4(0.09, 0.12, 0.14, 1.00)
    colors[clr.TitleBg]              = ImVec4(0.53, 0.20, 0.16, 0.65)
    colors[clr.TitleBgActive]        = ImVec4(0.56, 0.14, 0.14, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg]            = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.ScrollbarBg]          = ImVec4(0.02, 0.02, 0.02, 0.39)
    colors[clr.ScrollbarGrab]        = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
    colors[clr.ScrollbarGrabActive]  = ImVec4(0.09, 0.21, 0.31, 1.00)
    colors[clr.ComboBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.CheckMark]            = ImVec4(1.00, 0.28, 0.28, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.64, 0.14, 0.14, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(1.00, 0.37, 0.37, 1.00)
    colors[clr.Button]               = ImVec4(0.59, 0.13, 0.13, 1.00)
    colors[clr.ButtonHovered]        = ImVec4(0.69, 0.15, 0.15, 1.00)
    colors[clr.ButtonActive]         = ImVec4(0.67, 0.13, 0.07, 1.00)
    colors[clr.Header]               = ImVec4(0.20, 0.25, 0.29, 0.55)
    colors[clr.HeaderHovered]        = ImVec4(0.98, 0.38, 0.26, 0.80)
    colors[clr.HeaderActive]         = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Separator]            = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.SeparatorHovered]     = ImVec4(0.60, 0.60, 0.70, 1.00)
    colors[clr.SeparatorActive]      = ImVec4(0.70, 0.70, 0.90, 1.00)
    colors[clr.ResizeGrip]           = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]    = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]     = ImVec4(0.06, 0.05, 0.07, 1.00)
    colors[clr.CloseButton]          = ImVec4(0.40, 0.39, 0.38, 0.16)
    colors[clr.CloseButtonHovered]   = ImVec4(0.40, 0.39, 0.38, 0.39)
    colors[clr.CloseButtonActive]    = ImVec4(0.40, 0.39, 0.38, 1.00)
    colors[clr.PlotLines]            = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]     = ImVec4(1.00, 0.43, 0.35, 1.00)
    colors[clr.PlotHistogram]        = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
    colors[clr.TextSelectedBg]       = ImVec4(0.25, 1.00, 0.00, 0.43)
    colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end

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

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

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

    style.Alpha = 1.0
    style.ChildWindowRounding = 3
    style.WindowRounding = 3
    style.GrabRounding = 1
    style.GrabMinSize = 20
    style.FrameRounding = 3

    colors[clr.Text] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled] = ImVec4(0.00, 0.40, 0.41, 1.00)
    colors[clr.WindowBg] = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.ChildWindowBg] = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.Border] = ImVec4(0.00, 1.00, 1.00, 0.65)
    colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg] = ImVec4(0.44, 0.80, 0.80, 0.18)
    colors[clr.FrameBgHovered] = ImVec4(0.44, 0.80, 0.80, 0.27)
    colors[clr.FrameBgActive] = ImVec4(0.44, 0.81, 0.86, 0.66)
    colors[clr.TitleBg] = ImVec4(0.14, 0.18, 0.21, 0.73)
    colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.54)
    colors[clr.TitleBgActive] = ImVec4(0.00, 1.00, 1.00, 0.27)
    colors[clr.MenuBarBg] = ImVec4(0.00, 0.00, 0.00, 0.20)
    colors[clr.ScrollbarBg] = ImVec4(0.22, 0.29, 0.30, 0.71)
    colors[clr.ScrollbarGrab] = ImVec4(0.00, 1.00, 1.00, 0.44)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
    colors[clr.ScrollbarGrabActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.ComboBg] = ImVec4(0.16, 0.24, 0.22, 0.60)
    colors[clr.CheckMark] = ImVec4(0.00, 1.00, 1.00, 0.68)
    colors[clr.SliderGrab] = ImVec4(0.00, 1.00, 1.00, 0.36)
    colors[clr.SliderGrabActive] = ImVec4(0.00, 1.00, 1.00, 0.76)
    colors[clr.Button] = ImVec4(0.00, 0.65, 0.65, 0.46)
    colors[clr.ButtonHovered] = ImVec4(0.01, 1.00, 1.00, 0.43)
    colors[clr.ButtonActive] = ImVec4(0.00, 1.00, 1.00, 0.62)
    colors[clr.Header] = ImVec4(0.00, 1.00, 1.00, 0.33)
    colors[clr.HeaderHovered] = ImVec4(0.00, 1.00, 1.00, 0.42)
    colors[clr.HeaderActive] = ImVec4(0.00, 1.00, 1.00, 0.54)
    colors[clr.ResizeGrip] = ImVec4(0.00, 1.00, 1.00, 0.54)
    colors[clr.ResizeGripHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
    colors[clr.ResizeGripActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.CloseButton] = ImVec4(0.00, 0.78, 0.78, 0.35)
    colors[clr.CloseButtonHovered] = ImVec4(0.00, 0.78, 0.78, 0.47)
    colors[clr.CloseButtonActive] = ImVec4(0.00, 0.78, 0.78, 1.00)
    colors[clr.PlotLines] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotLinesHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogram] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.TextSelectedBg] = ImVec4(0.00, 1.00, 1.00, 0.22)
    colors[clr.ModalWindowDarkening] = ImVec4(0.04, 0.10, 0.09, 0.51)
end

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

    style.WindowPadding = imgui.ImVec2(9, 5)
    style.WindowRounding = 10
    style.ChildWindowRounding = 10
    style.FramePadding = imgui.ImVec2(5, 3)
    style.FrameRounding = 6.0
    style.ItemSpacing = imgui.ImVec2(9.0, 3.0)
    style.ItemInnerSpacing = imgui.ImVec2(9.0, 3.0)
    style.IndentSpacing = 21
    style.ScrollbarSize = 6.0
    style.ScrollbarRounding = 13
    style.GrabMinSize = 17.0
    style.GrabRounding = 16.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

    colors[clr.Text]                   = ImVec4(0.90, 0.90, 0.90, 1.00)
    colors[clr.TextDisabled]           = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]               = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.ChildWindowBg]          = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.PopupBg]                = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.Border]                 = ImVec4(0.82, 0.77, 0.78, 1.00)
    colors[clr.BorderShadow]           = ImVec4(0.35, 0.35, 0.35, 0.66)
    colors[clr.FrameBg]                = ImVec4(1.00, 1.00, 1.00, 0.28)
    colors[clr.FrameBgHovered]         = ImVec4(0.68, 0.68, 0.68, 0.67)
    colors[clr.FrameBgActive]          = ImVec4(0.79, 0.73, 0.73, 0.62)
    colors[clr.TitleBg]                = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.46, 0.46, 0.46, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.MenuBarBg]              = ImVec4(0.00, 0.00, 0.00, 0.80)
    colors[clr.ScrollbarBg]            = ImVec4(0.00, 0.00, 0.00, 0.60)
    colors[clr.ScrollbarGrab]          = ImVec4(1.00, 1.00, 1.00, 0.87)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(1.00, 1.00, 1.00, 0.79)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.80, 0.50, 0.50, 0.40)
    colors[clr.ComboBg]                = ImVec4(0.24, 0.24, 0.24, 0.99)
    colors[clr.CheckMark]              = ImVec4(0.99, 0.99, 0.99, 0.52)
    colors[clr.SliderGrab]             = ImVec4(1.00, 1.00, 1.00, 0.42)
    colors[clr.SliderGrabActive]       = ImVec4(0.76, 0.76, 0.76, 1.00)
    colors[clr.Button]                 = ImVec4(0.51, 0.51, 0.51, 0.60)
    colors[clr.ButtonHovered]          = ImVec4(0.68, 0.68, 0.68, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.67, 0.67, 0.67, 1.00)
    colors[clr.Header]                 = ImVec4(0.72, 0.72, 0.72, 0.54)
    colors[clr.HeaderHovered]          = ImVec4(0.92, 0.92, 0.95, 0.77)
    colors[clr.HeaderActive]           = ImVec4(0.82, 0.82, 0.82, 0.80)
    colors[clr.Separator]              = ImVec4(0.73, 0.73, 0.73, 1.00)
    colors[clr.SeparatorHovered]       = ImVec4(0.81, 0.81, 0.81, 1.00)
    colors[clr.SeparatorActive]        = ImVec4(0.74, 0.74, 0.74, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.80, 0.80, 0.80, 0.30)
    colors[clr.ResizeGripHovered]      = ImVec4(0.95, 0.95, 0.95, 0.60)
    colors[clr.ResizeGripActive]       = ImVec4(1.00, 1.00, 1.00, 0.90)
    colors[clr.CloseButton]            = ImVec4(0.45, 0.45, 0.45, 0.50)
    colors[clr.CloseButtonHovered]     = ImVec4(0.70, 0.70, 0.90, 0.60)
    colors[clr.CloseButtonActive]      = ImVec4(0.70, 0.70, 0.70, 1.00)
    colors[clr.PlotLines]              = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(1.00, 1.00, 1.00, 0.35)
    colors[clr.ModalWindowDarkening]   = ImVec4(0.88, 0.88, 0.88, 0.35)
end
 
Последнее редактирование:

Pashyka

Участник
220
17
спасибо большое

Как решить эту ошибку
Lua:
88: ')' expected near 'kypill'
Lua:
script_name('FamilyHelper v.1.0')
script_author('Lycorn')
script_description('FamilyHelper')
script_version('1.0')
require "lib.moonloader"
local imgui = require 'imgui'
local key = require 'vkeys'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
cp1251 = encoding.CP1251
local inicfg = require 'inicfg'
local directIni = 'moonloader\\config\\famhelper by lycorn.ini'
local mainIni = inicfg.load(nil, directIni)
local act = 0
--local stateIni = inicfg.save(mainIni, directIni)
local status = inicfg.load(mainIni, directIni)
local mainIni = inicfg.load({
    config = {
        vr=false,
        fam=false,
        j=false,
        ad=false,
        kypill=false,
        vr_text='',
        fam_text='',
        j_text='',
        ad_text='',
        kypillviptext='',
        vr_delay=60000,
        fam_delay=60000,
        j_delay=60000,
    }
}, "famhelper by lycorn")
inicfg.save(mainIni, 'famhelper by lycorn.ini')

local selected_item = imgui.ImInt(0)
local vr_delay = imgui.ImInt(mainIni.config.vr_delay / 60000)
local fam_delay = imgui.ImInt(mainIni.config.fam_delay / 60000)
local j_delay = imgui.ImInt(mainIni.config.j_delay / 60000)
local ad_delay = imgui.ImInt(mainIni.config.ad_delay / 60000)
local text_vr = imgui.ImBuffer(256)
local text_fam = imgui.ImBuffer(256)
local text_j = imgui.ImBuffer(256)
local text_ad = imgui.ImBuffer(256)
local text_vip = imgui.ImBuffer(256)
local vr = imgui.ImBool(mainIni.config.vr)
local fam = imgui.ImBool(mainIni.config.fam)
local j = imgui.ImBool(mainIni.config.j)
local ad = imgui.ImBool(mainIni.config.ad)
local checked1 = imgui.ImBool(false)
local checked2 = imgui.ImBool(false)
local checked3 = imgui.ImBool(false)
local checked4 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local checkbox = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local btn_size = imgui.ImVec2(-1, 0)
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(1000, 500), imgui.Cond.FirstUseEver)
        imgui.Begin('Family Helper v 1.0', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        imgui.BeginChild('##tabs', imgui.ImVec2(200, 460), true)
        if imgui.Button('Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button('АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button('Управление\nУчастниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button('          Меню\nЛидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        imgui.EndChild()
        imgui.SameLine()
        if act == 0 then
            imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
            if imgui.Combo('Стиль темы', selected_item, {'Красный', 'Синий', 'Монохрон', 'Свётло-Темный'}, 4, main_window_state) then
                if selected_item.v == 0 then
                  RedTheme()
                end
                  if selected_item.v == 1 then
                      BlueTheme()
                  end
                  if selected_item.v == 2 then
                      MonTheme()
                  end
                  if selected_item.v == 3 then
                      SvTmTheme()
                  end
              end
            imgui.Separator()
            if imgui.Checkbox('##kypillvip' kypill) then
                mainIni.config.kypill = kypill.v
                inicfg.save(mainIni, "famhelper by lycorn.ini")
            end
            if kypill.v then
               if imgui.InputText('Текст при покупки VIP', text_vip, main_window_state) then
                mainIni.config.kypillviptext = text_vip.v
                inicfg.save(mainIni, "famhelper by lycorn.ini")
            end
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(300)
            if imgui.Checkbox('/vr', vr) then
                mainIni.config.vr = vr.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/fam', fam) then
                mainIni.config.fam = fam.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/ad', ad) then
                mainIni.config.ad = ad.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.SameLine()
            if imgui.Checkbox('/j', j) then
                mainIni.config.j = j.v
                inicfg.save(mainIni, 'famhelper by lycorn.ini')
            end
            imgui.Separator()
            if vr.v then
                if imgui.InputText('Введите текст для /vr', text_vr, main_window_state) then
                    mainIni.config.vr_text = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##1', vr_delay, 1,60, main_window_state) then
                    mainIni.config.vr_delay = text_vr.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if fam.v then
                if imgui.InputText('Введите текст для /fam', text_fam, main_window_state) then
                    mainIni.config.fam_text = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##2', fam_delay, 1,60, main_window_state) then
                    mainIni.config.fam_delay = text_fam.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if j.v then
                if imgui.InputText('Введите текст для /j', text_j, main_window_state) then
                    mainIni.config.j_text = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##3', j_delay, 1,60, main_window_state) then
                    mainIni.config.j_delay = text_j.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            if ad.v then
                if imgui.InputText('Введите текст для /ad', text_ad, main_window_state) then
                    mainIni.config.ad_text = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                if imgui.SliderInt('Задержка в минутах##4', ad_delay, 1,60, main_window_state) then
                    mainIni.config.ad_delay = text_ad.v
                    inicfg.save(mainIni, "famhelper by lycorn.ini")
                end
                imgui.Separator()
            end
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        end
    end
    imgui.End()
end

if kypill.v then
    if text:find("приобрел PREMIUM VIP.") or text:find("приобрел Titan VIP.") and not text:find("говорит") and not text:find('- |') then
        sampSendChat("/vr "..mainIni.config.kypillviptext)
        inicfg.save(mainIni, 'famhelper by lycorn.ini')
        end
    end

function piar()
    autopiar = not autopiar
    if autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar включен!', 0x00BFFF)
    end
    lua_thread.create(function()
        if vr.v then
            if autopiar then
                sampSendChat('/vr '..mainIni.config.vr_text)
                wait(mainIni.config.vr_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if ad.v then
            if autopiar then
                sampSendChat('/ad '..mainIni.config.ad_text)
                wait(mainIni.config.ad_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if fam.v then
            if autopiar then
                sampSendChat('/fam '..mainIni.config.fam_text)
                wait(mainIni.config.fam_delay)
                return true
            end
        end
    end)
    lua_thread.create(function()
        if j.v then
            if autopiar then
                sampSendChat('/j '..mainIni.config.j_text)
                wait(mainIni.config.j_delay)
                return true
            end
        end
    end)
    if not autopiar then
        sampAddChatMessage(u8:decode'[FamHelper] AutoPiar выключен!', 0x00BFFF)
    end
end

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(2000) end
    sampAddChatMessage(u8:decode'[FamHelper] Автор скрипта - lycorn', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Версия скрипта - 1.0', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] Активация хелпера /famh', 0x00BFFF)
    sampAddChatMessage(u8:decode'[FamHelper] По всем вопросам пишите в ВК - @lycorn.maks', 0x00BFFF)
    sampRegisterChatCommand('famh', function() main_window_state.v = not main_window_state.v end)
    sampRegisterChatCommand('fpiar', piar)
    while true do
        wait(0)
        imgui.Process = main_window_state.v
        if checkbox.v then
            printStringNow('test', 1000)
        end
    end
end

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

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 0.78)
    colors[clr.TextDisabled]         = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.11, 0.15, 0.17, 1.00)
    colors[clr.ChildWindowBg]        = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.FrameBgHovered]       = ImVec4(0.12, 0.20, 0.28, 1.00)
    colors[clr.FrameBgActive]        = ImVec4(0.09, 0.12, 0.14, 1.00)
    colors[clr.TitleBg]              = ImVec4(0.53, 0.20, 0.16, 0.65)
    colors[clr.TitleBgActive]        = ImVec4(0.56, 0.14, 0.14, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.MenuBarBg]            = ImVec4(0.15, 0.18, 0.22, 1.00)
    colors[clr.ScrollbarBg]          = ImVec4(0.02, 0.02, 0.02, 0.39)
    colors[clr.ScrollbarGrab]        = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
    colors[clr.ScrollbarGrabActive]  = ImVec4(0.09, 0.21, 0.31, 1.00)
    colors[clr.ComboBg]              = ImVec4(0.20, 0.25, 0.29, 1.00)
    colors[clr.CheckMark]            = ImVec4(1.00, 0.28, 0.28, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.64, 0.14, 0.14, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(1.00, 0.37, 0.37, 1.00)
    colors[clr.Button]               = ImVec4(0.59, 0.13, 0.13, 1.00)
    colors[clr.ButtonHovered]        = ImVec4(0.69, 0.15, 0.15, 1.00)
    colors[clr.ButtonActive]         = ImVec4(0.67, 0.13, 0.07, 1.00)
    colors[clr.Header]               = ImVec4(0.20, 0.25, 0.29, 0.55)
    colors[clr.HeaderHovered]        = ImVec4(0.98, 0.38, 0.26, 0.80)
    colors[clr.HeaderActive]         = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Separator]            = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.SeparatorHovered]     = ImVec4(0.60, 0.60, 0.70, 1.00)
    colors[clr.SeparatorActive]      = ImVec4(0.70, 0.70, 0.90, 1.00)
    colors[clr.ResizeGrip]           = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]    = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]     = ImVec4(0.06, 0.05, 0.07, 1.00)
    colors[clr.CloseButton]          = ImVec4(0.40, 0.39, 0.38, 0.16)
    colors[clr.CloseButtonHovered]   = ImVec4(0.40, 0.39, 0.38, 0.39)
    colors[clr.CloseButtonActive]    = ImVec4(0.40, 0.39, 0.38, 1.00)
    colors[clr.PlotLines]            = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]     = ImVec4(1.00, 0.43, 0.35, 1.00)
    colors[clr.PlotHistogram]        = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
    colors[clr.TextSelectedBg]       = ImVec4(0.25, 1.00, 0.00, 0.43)
    colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end

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

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

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

    style.Alpha = 1.0
    style.ChildWindowRounding = 3
    style.WindowRounding = 3
    style.GrabRounding = 1
    style.GrabMinSize = 20
    style.FrameRounding = 3

    colors[clr.Text] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled] = ImVec4(0.00, 0.40, 0.41, 1.00)
    colors[clr.WindowBg] = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.ChildWindowBg] = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.Border] = ImVec4(0.00, 1.00, 1.00, 0.65)
    colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg] = ImVec4(0.44, 0.80, 0.80, 0.18)
    colors[clr.FrameBgHovered] = ImVec4(0.44, 0.80, 0.80, 0.27)
    colors[clr.FrameBgActive] = ImVec4(0.44, 0.81, 0.86, 0.66)
    colors[clr.TitleBg] = ImVec4(0.14, 0.18, 0.21, 0.73)
    colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.54)
    colors[clr.TitleBgActive] = ImVec4(0.00, 1.00, 1.00, 0.27)
    colors[clr.MenuBarBg] = ImVec4(0.00, 0.00, 0.00, 0.20)
    colors[clr.ScrollbarBg] = ImVec4(0.22, 0.29, 0.30, 0.71)
    colors[clr.ScrollbarGrab] = ImVec4(0.00, 1.00, 1.00, 0.44)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
    colors[clr.ScrollbarGrabActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.ComboBg] = ImVec4(0.16, 0.24, 0.22, 0.60)
    colors[clr.CheckMark] = ImVec4(0.00, 1.00, 1.00, 0.68)
    colors[clr.SliderGrab] = ImVec4(0.00, 1.00, 1.00, 0.36)
    colors[clr.SliderGrabActive] = ImVec4(0.00, 1.00, 1.00, 0.76)
    colors[clr.Button] = ImVec4(0.00, 0.65, 0.65, 0.46)
    colors[clr.ButtonHovered] = ImVec4(0.01, 1.00, 1.00, 0.43)
    colors[clr.ButtonActive] = ImVec4(0.00, 1.00, 1.00, 0.62)
    colors[clr.Header] = ImVec4(0.00, 1.00, 1.00, 0.33)
    colors[clr.HeaderHovered] = ImVec4(0.00, 1.00, 1.00, 0.42)
    colors[clr.HeaderActive] = ImVec4(0.00, 1.00, 1.00, 0.54)
    colors[clr.ResizeGrip] = ImVec4(0.00, 1.00, 1.00, 0.54)
    colors[clr.ResizeGripHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
    colors[clr.ResizeGripActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.CloseButton] = ImVec4(0.00, 0.78, 0.78, 0.35)
    colors[clr.CloseButtonHovered] = ImVec4(0.00, 0.78, 0.78, 0.47)
    colors[clr.CloseButtonActive] = ImVec4(0.00, 0.78, 0.78, 1.00)
    colors[clr.PlotLines] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotLinesHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogram] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.TextSelectedBg] = ImVec4(0.00, 1.00, 1.00, 0.22)
    colors[clr.ModalWindowDarkening] = ImVec4(0.04, 0.10, 0.09, 0.51)
end

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

    style.WindowPadding = imgui.ImVec2(9, 5)
    style.WindowRounding = 10
    style.ChildWindowRounding = 10
    style.FramePadding = imgui.ImVec2(5, 3)
    style.FrameRounding = 6.0
    style.ItemSpacing = imgui.ImVec2(9.0, 3.0)
    style.ItemInnerSpacing = imgui.ImVec2(9.0, 3.0)
    style.IndentSpacing = 21
    style.ScrollbarSize = 6.0
    style.ScrollbarRounding = 13
    style.GrabMinSize = 17.0
    style.GrabRounding = 16.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

    colors[clr.Text]                   = ImVec4(0.90, 0.90, 0.90, 1.00)
    colors[clr.TextDisabled]           = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.WindowBg]               = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.ChildWindowBg]          = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.PopupBg]                = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.Border]                 = ImVec4(0.82, 0.77, 0.78, 1.00)
    colors[clr.BorderShadow]           = ImVec4(0.35, 0.35, 0.35, 0.66)
    colors[clr.FrameBg]                = ImVec4(1.00, 1.00, 1.00, 0.28)
    colors[clr.FrameBgHovered]         = ImVec4(0.68, 0.68, 0.68, 0.67)
    colors[clr.FrameBgActive]          = ImVec4(0.79, 0.73, 0.73, 0.62)
    colors[clr.TitleBg]                = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.46, 0.46, 0.46, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 1.00)
    colors[clr.MenuBarBg]              = ImVec4(0.00, 0.00, 0.00, 0.80)
    colors[clr.ScrollbarBg]            = ImVec4(0.00, 0.00, 0.00, 0.60)
    colors[clr.ScrollbarGrab]          = ImVec4(1.00, 1.00, 1.00, 0.87)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(1.00, 1.00, 1.00, 0.79)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.80, 0.50, 0.50, 0.40)
    colors[clr.ComboBg]                = ImVec4(0.24, 0.24, 0.24, 0.99)
    colors[clr.CheckMark]              = ImVec4(0.99, 0.99, 0.99, 0.52)
    colors[clr.SliderGrab]             = ImVec4(1.00, 1.00, 1.00, 0.42)
    colors[clr.SliderGrabActive]       = ImVec4(0.76, 0.76, 0.76, 1.00)
    colors[clr.Button]                 = ImVec4(0.51, 0.51, 0.51, 0.60)
    colors[clr.ButtonHovered]          = ImVec4(0.68, 0.68, 0.68, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.67, 0.67, 0.67, 1.00)
    colors[clr.Header]                 = ImVec4(0.72, 0.72, 0.72, 0.54)
    colors[clr.HeaderHovered]          = ImVec4(0.92, 0.92, 0.95, 0.77)
    colors[clr.HeaderActive]           = ImVec4(0.82, 0.82, 0.82, 0.80)
    colors[clr.Separator]              = ImVec4(0.73, 0.73, 0.73, 1.00)
    colors[clr.SeparatorHovered]       = ImVec4(0.81, 0.81, 0.81, 1.00)
    colors[clr.SeparatorActive]        = ImVec4(0.74, 0.74, 0.74, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.80, 0.80, 0.80, 0.30)
    colors[clr.ResizeGripHovered]      = ImVec4(0.95, 0.95, 0.95, 0.60)
    colors[clr.ResizeGripActive]       = ImVec4(1.00, 1.00, 1.00, 0.90)
    colors[clr.CloseButton]            = ImVec4(0.45, 0.45, 0.45, 0.50)
    colors[clr.CloseButtonHovered]     = ImVec4(0.70, 0.70, 0.90, 0.60)
    colors[clr.CloseButtonActive]      = ImVec4(0.70, 0.70, 0.70, 1.00)
    colors[clr.PlotLines]              = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(1.00, 1.00, 1.00, 0.35)
    colors[clr.ModalWindowDarkening]   = ImVec4(0.88, 0.88, 0.88, 0.35)
end

if imgui.Checkbox('##kypillvip', kypill) then

Запятую забыл после ковычек