при чек-боксе с галочкой выводится много раз SampAddChatMessage.
KOD:
local imgui = require 'mimgui'
local encoding = require 'encoding'
local sampev = require('lib.samp.events')
encoding.default = 'CP1251'
u8 = encoding.UTF8
local ffi = require('ffi')
local checkboxone = imgui.new.bool()
local renderWindow = imgui.new.bool(false)
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
end)
local newFrame = imgui.OnFrame(
function() return renderWindow[0] end,
function(player)
local resX, resY = getScreenResolution()
local sizeX, sizeY = 300, 300
imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
if imgui.Begin('Main Window', renderWindow) then
if imgui.Checkbox(u8'хзхз.', checkboxone) then
sampAddChatMessage('хзхзхз ' .. (checkboxone[0] and 'чтото включено' or 'что товыключено'), -1)
end
if imgui.Button(u8'хзхз') and checkboxone[0] == false then
lua_thread.create(function()
sampSendChat('хзхзхз')
wait(1000)
sampSendChat('тоже хзхзхз')
end)
elseif checkboxone[0] then
lua_thread.create(function()
sampSendChat('Это много раз выводится')
wait(1000)
sampSendChat('хзхзхзхзхз')
end)
end
imgui.End()
end
end
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('xzxz', function()
renderWindow[0] = not renderWindow[0]
end)
end