require "lib.moonloader"
local imgui = require 'imgui'
local encoding = require 'encoding'
local main_window_state = imgui.ImBool(false)
encoding.default = 'CP1251'
u8 = encoding.UTF8
function main()
if not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("test", function() main_window_state.v = not main_window_state.v end)
while true do
wait(0)
imgui.Process = main_window_state.v
end
end
function imgui.OnDrawFrame()
if main_window_state.v then
local sw, sh = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(1070, 500), imgui.Cond.FirstUseEver)
imgui.Begin(u8"Test script", main_window_state)
imgui.BeginChild("child", imgui.ImVec2(255, 450), true)
if imgui.Button(u8"Основные", imgui.ImVec2(-1, 100)) then menu = 1 end
if imgui.Button(u8"Другое", imgui.ImVec2(-1, 100)) then menu = 2 end
if imgui.Button(u8"Для авто", imgui.ImVec2(-1, 100)) then menu = 3 end
if imgui.Button(u8"Читики", imgui.ImVec2(-1, 100)) then menu = 4 end
imgui.EndChild()
imgui.SameLine()
if menu == 1 then
imgui.BeginChild("child2", imgui.ImVec2(780, 450), true)
imgui.Text("1")
imgui.EndChild()
end
imgui.SameLine()
if menu == 2 then
imgui.BeginChild("child2", imgui.ImVec2(780, 450), true)
imgui.Text("2")
imgui.EndChild()
end
imgui.SameLine()
if menu == 3 then
imgui.BeginChild("child2", imgui.ImVec2(780, 450), true)
imgui.Text("3")
imgui.EndChild()
end
imgui.SameLine()
if menu == 4 then
imgui.BeginChild("child2", imgui.ImVec2(780, 450), true)
imgui.Text("4")
imgui.EndChild()
end
imgui.End()
end
end