--Типа этого?
require "lib.moonloader"
require 'lib.vkeys'
local imgui = require 'imgui'
local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        imgui.Begin('My window', main_window_state)
            imgui.Text('Hello world')
        imgui.End()
    end
end
function main()
    while true do wait(0)
        if wasKeyPressed(VK_X) and not isSampfuncsConsoleActive() and not sampIsChatInputActive() and not isPauseMenuActive() then -- активация по нажатию клавиши X + Проверка открыты ли Сампфункс, чат, и пауза(esc)
            main_window_state.v = not main_window_state.v
        end
        imgui.Process = main_window_state.v -- теперь значение imgui.Process всегда будет задаваться в зависимости от активности основного окна
    end
end