local imgui = require('imgui')
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local window = imgui.ImBool(false)
local timer_start = -1
function main()
while not isSampAvailable() do wait(200) end
imgui.Process = false
window.v = true --show window on start
while true do
wait(0)
imgui.Process = window.v
if timer_start ~= -1 then
if math.floor(timer_start + 11 - os.clock()) == 0 then
sampAddChatMessage('Прошло 10 секунд!', -1)
timer_start = -1
end
end
end
end
function imgui.OnDrawFrame()
if window.v then
local resX, resY = getScreenResolution()
local sizeX, sizeY = 300, 300 -- WINDOW SIZE
imgui.SetNextWindowPos(imgui.ImVec2(resX / 2 - sizeX / 2, resY / 2 - sizeY / 2), imgui.Cond.FirstUseEver)
imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
imgui.Begin('Window Title', window)
if imgui.Button('START', imgui.ImVec2(100, 20)) then
timer_start = os.clock()
end
imgui.Text(timer_start == -1 and u8'Таймер выключен' or u8'Осталось: '..tostring(math.floor(timer_start + 11 - os.clock()))..u8' сек.')
imgui.End()
end
end