local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = "CP1251"
u8 = encoding.UTF8
local main_window_state = imgui.ImBool(false)
local secondary_window_state = imgui.ImBool(false)
local sw, sh = getScreenResolution()
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("bot", bot)
imgui.Process = false
while true do
wait(0)
end
end
function bot(arg)
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function imgui.OnDrawFrame()
if not main_window_state.v and not secondary_window_state.v then
imgui.Process = false
end
if main_window_state.v then
imgui.SetNextWindowSize(imgui.ImVec2(500, 290), imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.Begin("text", main_window_state)
end
if imgui.Button(u8'2 окно', imgui.ImVec2(100, 25) ) then
secondary_window_state.v = not secondary_window_state.v
end
imgui.End()
end
if secondary_window_state.v then
imgui.SetNextWindowSize(imgui.ImVec2(820, 250), imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2((sw / 6), sh / 6), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.Begin('text', secondary_window_state)
imgui.End()
end
end