-- // Библиотеки // --
local imgui = require 'imgui'
local key = require 'vkeys'
local encoding = require 'encoding'
local sampev = require 'lib.samp.events'
local inicfg = require 'inicfg'
encoding.default = 'CP1251'
u8 = encoding.UTF8
-- // Для кнопок | imgui // --
local main_window_state = imgui.ImBool(false)
-- // Прочее // --
local colorReport = imgui.ImColor(4278241535) --
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand('/test', function() main_window_state.v = not main_window_state.v end)
sampRegisterChatCommand('/test1', test_1)
sampRegisterChatCommand('/test2', test_2)
while true do
wait(0)
imgui.Process = main_window_state.v
end
end
function test_1(arg)
sampAddChatMessage(Load_Config.ConfigIni.test__, -1)
end
function test_2(arg)
local result = sampIsPlayerPaused(arg)
if result then
afk = 'da'
else
afk = 'net'
end
sampAddChatMessage('>'..afk, -1)
end
function imgui.OnDrawFrame()
if main_window_state.v then
imgui.SetNextWindowSize(imgui.ImVec2(200, 200), imgui.Cond.FirstUseEver)
imgui.Begin('My window', main_window_state)
imgui.Text(u8'орпопр')
if not font_changed and imgui.Button('Change Font') then
font_changed = true
lua_thread.create(function()
-- Fonts' texture cannot be rebuilt within OnDrawFrame, so we doing it in a separate script-thread
wait(0) -- delay here is necessary
imgui.SwitchContext()
imgui.GetIO().Fonts:Clear()
glyph_ranges_cyrillic = imgui.GetIO().Fonts:GetGlyphRangesCyrillic()
imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\impact.ttf', 15.0, nil, glyph_ranges_cyrillic)
imgui.RebuildFonts()
end)
end
if imgui.ColorEdit3("##reportColor", colorReport.v, imgui.ColorEditFlags.NoInputs + imgui.ColorEditFlags.NoLabel + imgui.ColorEditFlags.NoAlpha) then
local col32 = colorReport:GetU32() -- та функция
end
if imgui.Button('Message') then
sampAddChatMessage('1111', -7)
end
imgui.End()
end
end