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

sep

Известный
714
79
как сделать чтобы верталеты тоже перекрашывались ?

код:
        if isPlayerPlaying(PLAYER_HANDLE) then
            if isCharInAnyCar(PLAYER_PED) and testCheat('car') then
                local car = storeCarCharIsInNoSave(PLAYER_PED)
                local new_r = 30
                local new_g = 255
                local new_b = 50
                for_each_vehicle_material(car, function(mat)
                    local r, g, b, a = mat:get_color()
                    if (r == 0x3C and g == 0xFF and b == 0x00) or (r == 0xFF and g == 0x00 and b == 0xAF) then
                        mat:set_color(new_r, new_g, new_b, a)
                    end
                end)
            end
        end
 

tsunamiqq

Участник
432
17
Изза чего может крашить при нажатие на кнопку "Управление Участниками"
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 fa = require 'faIcons'
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })

function imgui.BeforeDrawFrame()
    if fa_font == nil then
        local font_config = imgui.ImFontConfig()
        font_config.MergeMode = true
        fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fontawesome-webfont.ttf', 14.0, font_config, fa_glyph_ranges)
    end
end

--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,
    },
    statistic = {
        stat_off_on=false,
        id=false,
        fama=false,
        organization=false,
        rang_org=false,
        work=false,
        hp=false,
        bronya=false,
        time=false,
        onlined=false,
        afkd=false,
        onlinen=false,
        afkn=false,
    }
}, "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 checked5 = imgui.ImBool(false)
local checked6 = imgui.ImBool(false)
local checked7 = imgui.ImBool(false)
local checked8 = imgui.ImBool(false)
local checked9 = imgui.ImBool(false)
local checked10 = imgui.ImBool(false)
local checked11 = imgui.ImBool(false)
local checked12 = imgui.ImBool(false)
local checked13 = 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(fa.ICON_BARS .. ' Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button(fa.ICON_BELL_O .. ' АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button(fa.ICON_USER ..' Управление Участниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button(fa.ICON_USER_CIRCLE .. ' Меню Лидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        if imgui.Button(fa.ICON_SERVER .. ' Настройка Статистики', imgui.ImVec2(185,50), main_window_state) then act = 4 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()
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(290)
            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.SetCursorPosX(290)
            imgui.Text('Активация пиара /fpiar')
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                if imgui.Button(famListState and u8"Онлайн игроки" or u8"Оффлайн игроки", imgui.ImVec2(477.5, 20)) then
                    famListState = not famListState
                end
                if imgui.Button(u8"Обновить список", imgui.ImVec2(235, 20)) then
                    sampSendChat(famListState and "/fammenu" or "/fmembers")
                    if famListState then
                        updateOffline = true
                        for k, v in pairs(offMembers) do
                            _G["offMembers"..k.."_bool"] = nil
                        end
                        offMembers = {}
                        offMembersNum = 0
                    else    
                        updateOnline = true
                        for k, v in pairs(onlineMembers) do
                            _G["onlineMembers"..k.."_bool"] = nil
                        end
                        onlineMembers = {}
                        onlineMembersNum = 0
                        onlMembersNum = 0
                    end
                end
                imgui.SameLine()
                if imgui.Button(u8"Кикнуть", imgui.ImVec2(235, 20)) then
                    if (famListState and offMembersNum == 0) or (not famListState and onlMembersNum == 0) then 
                        sampAddChatMessage("Неверное количество игроков", -1)
                    else
                        if famListState then
                            for k, v in pairs(offMembers) do
                                if _G["offMembers"..k.."_bool"].v then
                                    sampSendChat("/famoffkick "..v[1])
                                    offMembersNum = offMembersNum - 1
                                    offMembers[k] = nil
                                    _G["offMembers"..k.."_bool"] = nil
                                end
                            end
                        else
                            sampAddChatMessage(onlMembersNum, -1)
                            for k, v in pairs(onlineMembers) do
                                if _G["onlineMembers"..k.."_bool"].v then
                                    sampSendChat("/famuninvite "..v)
                                    onlMembersNum = onlMembersNum - 1
                                    onlineMembers[k] = nil
                                    _G["onlineMembers"..k.."_bool"] = nil
                                end
                            end    
                        end
                    end
                end
                imgui.PushItemWidth(477.5)
                imgui.InputText(u8"##find", membersFindBuffer)
                imgui.PopItemWidth()
                imgui.Separator()
                if famListState then
                    imgui.Text(u8"\t\t\tНикнейм\t\t\t\t\t\tПоследний вход")
                    for k, v in pairs(offMembers) do
                        if (membersFindBuffer.v ~= "" and string.lower(v[1]):find(string.lower(u8:decode(membersFindBuffer.v)))) or membersFindBuffer.v == "" then
                            if imgui.Checkbox("##offMembersBool"..k, _G["offMembers"..k.."_bool"]) then
                                if _G["offMembers"..k.."_bool"].v then
                                    offMembersNum = offMembersNum + 1
                                else
                                    offMembersNum = offMembersNum - 1
                                end
                            end
                            imgui.SameLine(40)
                            imgui.Text(u8(v[1]))
                            imgui.SameLine(200)
                            imgui.Text(u8(v[2].." назад"))
                        end
                    end
                else
                    for k, v in pairs(onlineMembers) do
                        if (membersFindBuffer.v ~= "" and string.lower(v):find(string.lower(u8:decode(membersFindBuffer.v)))) or membersFindBuffer.v == "" then
                            if imgui.Checkbox("##onlineMembersBool"..k, _G["onlineMembers"..k.."_bool"]) then
                                if _G["onlineMembers"..k.."_bool"].v then
                                    offMembersNum = offMembersNum + 1
                                else
                                    offMembersNum = offMembersNum - 1
                                end
                            end
                            imgui.SameLine(40)
                            imgui.Text(u8(v))
                            imgui.SameLine(160)
                            if imgui.Button(u8("Изменить ранг##"..k), imgui.ImVec2(100, 20)) then
                                sampAddChatMessage(v.."1", -1)
                            end
                            imgui.SameLine()
                            if imgui.Button(u8("Выдать деньги##"..k), imgui.ImVec2(100, 20)) then
                                sampAddChatMessage(v.."2", -1)
                            end
                        end
                    end
                end
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 4 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.SetCursorPosX(290)
                if imgui.Checkbox('Вкл/Выкл статистику', checked1) then
                        mainIni.statistic.stat_off_on = checked1.v
                        inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                imgui.Separator()
                if imgui.Checkbox('Ваш ID', checked2) then
                    mainIni.statistic.id = checked2.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о семье', checked3) then
                    mainIni.statistic.fama = checked3.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о организации', checked4) then
                    mainIni.statistic.organization = checked4.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о ранге', checked5) then
                    mainIni.statistic.rang_org = checked5.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о работе', checked6) then
                    mainIni.statistic.work = checked6.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о здоровье', checked7) then
                    mainIni.statistic.hp = checked7.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о броне', checked8) then
                    mainIni.statistic.bronya = checked8.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о времени', checked9) then
                    mainIni.statistic.time = checked9.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Онлайн за день', checked10) then
                    mainIni.statistic.onlined = checked10.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('АФК за день', checked11) then
                    mainIni.statistic.afkd = checked11.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Онлайн за неделю', checked12) then
                    mainIni.statistic.onlinen = checked12.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('АФК за неделю', checked13) then
                    mainIni.statistic.afkn = checked13.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                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 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
 
Последнее редактирование:

Dmitriy Makarov

25.05.2021
Проверенный
2,510
1,139
Изза чего может крашить при нажатие на кнопку "Управление Участниками"
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 fa = require 'faIcons'
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })

function imgui.BeforeDrawFrame()
    if fa_font == nil then
        local font_config = imgui.ImFontConfig()
        font_config.MergeMode = true
        fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fontawesome-webfont.ttf', 14.0, font_config, fa_glyph_ranges)
    end
end

--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,
    },
    statistic = {
        stat_off_on=false,
        id=false,
        fama=false,
        organization=false,
        rang_org=false,
        work=false,
        hp=false,
        bronya=false,
        time=false,
        onlined=false,
        afkd=false,
        onlinen=false,
        afkn=false,
    }
}, "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 checked5 = imgui.ImBool(false)
local checked6 = imgui.ImBool(false)
local checked7 = imgui.ImBool(false)
local checked8 = imgui.ImBool(false)
local checked9 = imgui.ImBool(false)
local checked10 = imgui.ImBool(false)
local checked11 = imgui.ImBool(false)
local checked12 = imgui.ImBool(false)
local checked13 = 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(fa.ICON_BARS .. ' Настройки', imgui.ImVec2(185,50), main_window_state) then act = 0 end
        if imgui.Button(fa.ICON_BELL_O .. ' АвтоПиар', imgui.ImVec2(185,50), main_window_state) then act = 1 end
        if imgui.Button(fa.ICON_USER ..' Управление Участниками', imgui.ImVec2(185,50), main_window_state) then act = 2 end
        if imgui.Button(fa.ICON_USER_CIRCLE .. ' Меню Лидера-Заместителя', imgui.ImVec2(185,50), main_window_state) then act = 3 end
        if imgui.Button(fa.ICON_SERVER .. ' Настройка Статистики', imgui.ImVec2(185,50), main_window_state) then act = 4 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()
            imgui.EndChild()
        elseif act == 1 then
            imgui.BeginChild('##twice', imgui.ImVec2(860, 460), true)
            imgui.SetCursorPosX(290)
            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.SetCursorPosX(290)
            imgui.Text('Активация пиара /fpiar')
            imgui.EndChild()
        elseif act == 2 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                if imgui.Button(famListState and u8"Онлайн игроки" or u8"Оффлайн игроки", imgui.ImVec2(477.5, 20)) then
                    famListState = not famListState
                end
                if imgui.Button(u8"Обновить список", imgui.ImVec2(235, 20)) then
                    sampSendChat(famListState and "/fammenu" or "/fmembers")
                    if famListState then
                        updateOffline = true
                        for k, v in pairs(offMembers) do
                            _G["offMembers"..k.."_bool"] = nil
                        end
                        offMembers = {}
                        offMembersNum = 0
                    else  
                        updateOnline = true
                        for k, v in pairs(onlineMembers) do
                            _G["onlineMembers"..k.."_bool"] = nil
                        end
                        onlineMembers = {}
                        onlineMembersNum = 0
                        onlMembersNum = 0
                    end
                end
                imgui.SameLine()
                if imgui.Button(u8"Кикнуть", imgui.ImVec2(235, 20)) then
                    if (famListState and offMembersNum == 0) or (not famListState and onlMembersNum == 0) then
                        sampAddChatMessage("Неверное количество игроков", -1)
                    else
                        if famListState then
                            for k, v in pairs(offMembers) do
                                if _G["offMembers"..k.."_bool"].v then
                                    sampSendChat("/famoffkick "..v[1])
                                    offMembersNum = offMembersNum - 1
                                    offMembers[k] = nil
                                    _G["offMembers"..k.."_bool"] = nil
                                end
                            end
                        else
                            sampAddChatMessage(onlMembersNum, -1)
                            for k, v in pairs(onlineMembers) do
                                if _G["onlineMembers"..k.."_bool"].v then
                                    sampSendChat("/famuninvite "..v)
                                    onlMembersNum = onlMembersNum - 1
                                    onlineMembers[k] = nil
                                    _G["onlineMembers"..k.."_bool"] = nil
                                end
                            end  
                        end
                    end
                end
                imgui.PushItemWidth(477.5)
                imgui.InputText(u8"##find", membersFindBuffer)
                imgui.PopItemWidth()
                imgui.Separator()
                if famListState then
                    imgui.Text(u8"\t\t\tНикнейм\t\t\t\t\t\tПоследний вход")
                    for k, v in pairs(offMembers) do
                        if (membersFindBuffer.v ~= "" and string.lower(v[1]):find(string.lower(u8:decode(membersFindBuffer.v)))) or membersFindBuffer.v == "" then
                            if imgui.Checkbox("##offMembersBool"..k, _G["offMembers"..k.."_bool"]) then
                                if _G["offMembers"..k.."_bool"].v then
                                    offMembersNum = offMembersNum + 1
                                else
                                    offMembersNum = offMembersNum - 1
                                end
                            end
                            imgui.SameLine(40)
                            imgui.Text(u8(v[1]))
                            imgui.SameLine(200)
                            imgui.Text(u8(v[2].." назад"))
                        end
                    end
                else
                    for k, v in pairs(onlineMembers) do
                        if (membersFindBuffer.v ~= "" and string.lower(v):find(string.lower(u8:decode(membersFindBuffer.v)))) or membersFindBuffer.v == "" then
                            if imgui.Checkbox("##onlineMembersBool"..k, _G["onlineMembers"..k.."_bool"]) then
                                if _G["onlineMembers"..k.."_bool"].v then
                                    offMembersNum = offMembersNum + 1
                                else
                                    offMembersNum = offMembersNum - 1
                                end
                            end
                            imgui.SameLine(40)
                            imgui.Text(u8(v))
                            imgui.SameLine(160)
                            if imgui.Button(u8("Изменить ранг##"..k), imgui.ImVec2(100, 20)) then
                                sampAddChatMessage(v.."1", -1)
                            end
                            imgui.SameLine()
                            if imgui.Button(u8("Выдать деньги##"..k), imgui.ImVec2(100, 20)) then
                                sampAddChatMessage(v.."2", -1)
                            end
                        end
                    end
                end
                imgui.EndChild()
        elseif act == 3 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.EndChild()
        elseif act == 4 then
                imgui.BeginChild('##once', imgui.ImVec2(860, 460), true)
                imgui.SetCursorPosX(290)
                if imgui.Checkbox('Вкл/Выкл статистику', checked1) then
                        mainIni.statistic.stat_off_on = checked1.v
                        inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                imgui.Separator()
                if imgui.Checkbox('Ваш ID', checked2) then
                    mainIni.statistic.id = checked2.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о семье', checked3) then
                    mainIni.statistic.fama = checked3.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о организации', checked4) then
                    mainIni.statistic.organization = checked4.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о ранге', checked5) then
                    mainIni.statistic.rang_org = checked5.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о работе', checked6) then
                    mainIni.statistic.work = checked6.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о здоровье', checked7) then
                    mainIni.statistic.hp = checked7.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о броне', checked8) then
                    mainIni.statistic.bronya = checked8.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Информация о времени', checked9) then
                    mainIni.statistic.time = checked9.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Онлайн за день', checked10) then
                    mainIni.statistic.onlined = checked10.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('АФК за день', checked11) then
                    mainIni.statistic.afkd = checked11.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('Онлайн за неделю', checked12) then
                    mainIni.statistic.onlinen = checked12.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                if imgui.Checkbox('АФК за неделю', checked13) then
                    mainIni.statistic.afkn = checked13.v
                    inicfg.save(mainIni, 'famhelper by lycorn.ini')
                end
                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 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
1637374197209.png

Убери везде main_window_state и попробуй.
Кнопка 2 аргумента же принимает, а ты 3-й передаешь. (;
C++:
IMGUI_API bool          Button(const char* label, const ImVec2& size = ImVec2(0,0)); // Текст и размер

Как емулировать нажатие клавиши?
И еще как использовать там ~A~ .+ короче такое
Можно ещё синхрой, но я не умею.
 
  • Вау
Реакции: F0RQU1N and

_Nelit_

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

_Nelit_

Потрачен
109
39
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
как скачать файл с сайта и закинуть в корень сампа
Lua:
function downloadFile()
    local file_url = 'https://сайт.ру/твой_файл.lua' -- Поменяй тут
    local file_path = getWorkingDirectory()..'/moonloader/файл.lua' -- Путь к файлу куда он будет сохранён. Обязательно указывать расширение файла.

    downloadUrlToFile(file_url, file_path, function(id, status, p1, p2)
        if status == STATUS_ENDDOWNLOADDATA then
            sampAddChatMessage('Файл скачан!', -1)
        end
    end)
end

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

    sampRegisterChatCommand('download', function()
        downloadFile()
    end)

    while true do
        wait(0)

    end
end
 
  • Нравится
Реакции: m1racles

BARRY BRADLEY

Известный
709
177
все равно не работает, вот окно Посмотреть вложение 123087


короче у меня все вводит, просто нужно чтобы после sampSendDialogResponse(2, 1, nil, 'parol suda') автоматом тыкало энтер
 

sep

Известный
714
79
КАК ПОФКСИТЬ КАЗАБРЫ ЕСЛИ ЯЗЫК АНГЛИЗКИЙ
if imgui.MenuItem(fa.ICON_FILES_O) then setClipboardText(mainIni.config.a4) end
 

#SameLine

Известный
422
39
Как сделать ввод только цифр в Input поле,
Lua:
imgui.NewInputText(u8'1##', test, 50, u8'Цифра', 1)
-- его настройки

function imgui.NewInputText(lable, val, width, hint, hintpos)
    local hint = hint and hint or ''
    local hintpos = tonumber(hintpos) and tonumber(hintpos) or 1
    local cPos = imgui.GetCursorPos()
    imgui.PushItemWidth(width)
    local result = imgui.InputText(lable, val)
    if #val.v == 0 then
        local hintSize = imgui.CalcTextSize(hint)
        if hintpos == 2 then imgui.SameLine(cPos.x + (width - hintSize.x) / 2)
        elseif hintpos == 3 then imgui.SameLine(cPos.x + (width - hintSize.x - 5))
        else imgui.SameLine(cPos.x + 5) end
        imgui.TextColored(imgui.ImVec4(1.00, 1.00, 1.00, 0.40), tostring(hint))
    end
    imgui.PopItemWidth()
    return result
end
 

P3rsik

Активный
213
32
как сделать чтобы верталеты тоже перекрашывались ?

код:
        if isPlayerPlaying(PLAYER_HANDLE) then
            if isCharInAnyCar(PLAYER_PED) and testCheat('car') then
                local car = storeCarCharIsInNoSave(PLAYER_PED)
                local new_r = 30
                local new_g = 255
                local new_b = 50
                for_each_vehicle_material(car, function(mat)
                    local r, g, b, a = mat:get_color()
                    if (r == 0x3C and g == 0xFF and b == 0x00) or (r == 0xFF and g == 0x00 and b == 0xAF) then
                        mat:set_color(new_r, new_g, new_b, a)
                    end
                end)
            end
        end
isCharInAnyPlane
 

auf.exe

Участник
41
12
Здраствуйте, у меня есть вопрос.Вот припустим у меня есть строка.
1637401476141.png

Но когда я в скрипте блочу то только одного админа, как блокать все такие подобные строки и выводить в консоль?
 

P3rsik

Активный
213
32
все равно не работает, вот окно Посмотреть вложение 123087


короче у меня все вводит, просто нужно чтобы после sampSendDialogResponse(2, 1, nil, 'parol suda') автоматом тыкало энтер
Lua:
function ev.onShowDialog(dialogId, style, title, button1, button2, text)
 if title:find('Trinity GTA') then
        lua_thread.create(function()
            sampSetCurrentDialogEditboxText('Your pass')
            wait(1000)
            sampCloseCurrentDialogWithButton(1)
        end)
    end
end
 

Rice.

Известный
Модератор
1,756
1,712
Здраствуйте, у меня есть вопрос.Вот припустим у меня есть строка.
Посмотреть вложение 123150
Но когда я в скрипте блочу то только одного админа, как блокать все такие подобные строки и выводить в консоль?
строчку из чатлога сюда кинь

смотри, пароль вводит и я уже вхожу, но у меня остается менюшка со входом, типо мне нужно нажать войти и она пропадает, как сделать чтобы она автоматом скипалась?
Lua:
local ev = require 'lib.samp.events'
function ev.onShowDialog(dialogId, style, title, button1, button2, text)
  if dialogId == 2 then
    sampSendDialogResponse(dialogId, 1, nil, 'password')
    return false
  end
end
 
  • Нравится
Реакции: linmsqn

auf.exe

Участник
41
12
строчку из чатлога сюда кинь


Lua:
local ev = require 'lib.samp.events'
function ev.onShowDialog(dialogId, style, title, button1, button2, text)
  if dialogId == 2 then
    sampSendDialogResponse(dialogId, 1, nil, 'password')
    return false
  end
end
Администратор Thomas_Kennedy[355] забанил игрока Dava_Serso[280] на 30 дней. Причина: Чит // N.Vancouver