require "lib.moonloader"
local rkeys = require("rkeys")
local imgui = require 'imgui'
local encoding = require("encoding")
local main_window_state = imgui.ImBool(false)
local u8 = encoding.UTF8
encoding.default = "CP1251"
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do wait(0) imgui.Process = true
if isKeyJustPressed(VK_1) and not sampIsChatInputActive() and not isSampfuncsConsoleActive() then
main_window_state.v = not main_window_state.v
end
if main_window_state.v == false then
imgui.Process = false
end
end
end
function imgui.OnDrawFrame()
if main_window_state.v then
local x, y = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(x/2, y/2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(850, 535), imgui.Cond.FirstUseEver)
imgui.Begin(u8" New", main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
imgui.Columns(2,"", true)
imgui.SetColumnWidth(-1, 232)
imgui.BeginChild("##menubok", imgui.ImVec2(225, 500), true, imgui.WindowFlags.NoScrollbar)
if imgui.Button('1',imgui.ImVec2(210, 45)) then
menu = 1
end
imgui.EndChild()
if menu == 1 then
imgui.BeginChild("##new", imgui.ImVec2(200, 150), true)
if imgui.Button(u8'Test 1',imgui.ImVec2(210, 45)) then
mmenu = 2
end
if imgui.Button(u8'Сказать привет',imgui.ImVec2(210, 45)) then
mmenu = 3
end
imgui.EndChild()
if mmenu == 2 then
imgui.SetCursorPos(imgui.ImVec2(240, 210))
if imgui.Button(u8'Test 2',imgui.ImVec2(210, 45)) then
sampAddChatMessage("Привет", -1)
end
end
if mmenu == 3 then
imgui.SetCursorPos(imgui.ImVec2(441, 210))
if imgui.Button(u8'Test 3',imgui.ImVec2(210, 45)) then
sampAddChatMessage("Пока")
end
end
end
imgui.End()
end
end