local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local new = imgui.new
local WinState = new.bool()
local bgColor = {0.2, 0.2, 0.2, 1.0}
local barColor = {0.0, 1.0, 0.0, 1.0}
local newBgColor = imgui.new.float[4](bgColor[1], bgColor[2], bgColor[3], bgColor[4])
local newBarColor = imgui.new.float[4](barColor[1], barColor[2], barColor[3], barColor[4])
function imgui.CustomProgressBar(value, size, text)
imgui.PushStyleColor(imgui.Col.FrameBg, bgColor)
imgui.PushStyleColor(imgui.Col.PlotHistogram, barColor)
imgui.ProgressBar(value, size, text)
imgui.PopStyleColor(2)
end
imgui.OnFrame(function() return WinState[0] end, function(player)
imgui.SetNextWindowPos(imgui.ImVec2(500,500), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(245, 270), imgui.Cond.Always)
imgui.Begin('##Window', WinState, imgui.WindowFlags.NoResize)
local changedBgColor, _ = imgui.ColorEdit4("Background Color", newBgColor)
if changedBgColor then
bgColor = {newBgColor[0], newBgColor[1], newBgColor[2], newBgColor[3]}
end
local changedBarColor, _ = imgui.ColorEdit4("Bar Color", newBarColor)
if changedBarColor then
barColor = {newBarColor[0], newBarColor[1], newBarColor[2], newBarColor[3]}
end
local healthValue = tonumber(getCharHealth(PLAYER_PED)) / 100
imgui.CustomProgressBar(healthValue, imgui.ImVec2(100, 24), tostring(getCharHealth(PLAYER_PED)))
imgui.End()
end)
function main()
sampRegisterChatCommand('cmd', function() WinState[0] = not WinState[0] end)
wait(-1)
end