local ev = require 'lib.samp.events'
local imgui = require 'mimgui'
local sw, sh = getScreenResolution()
local mainFrame = imgui.new.bool(false)
local imgui_text = ""
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("mimgui", function()
mainFrame[0] = not mainFrame[0]
end)
while true do
wait(0)
end
end
function ev.onServerMessage(color, text)
if text:find(".+%[%d+%] говорит:{%x+} (%d+)") then
imgui_text = text:match(".+%[%d+%] говорит:{%x+} (%d+)")
end
end
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
end)
local Frame = imgui.OnFrame(
function() return mainFrame[0] end,
function(self)
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(300, 300), imgui.Cond.FirstUseEver)
imgui.Begin("ImGui", mainFrame)
imgui.Text(imgui_text)
imgui.End()
end
)