- 104
- 6
- Версия MoonLoader
- .027.0-preview
Как добавить сюда крестик чтоб закрывать Imgui окно?
UPD: обновил код
local imgui = require 'imgui'
local themes = import "resourse/imgui_themes.lua"
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local arr = os.date("*t")
local mm = imgui.ImBool(false)
local style = imgui.GetStyle()
local radio = imgui.ImInt(0)
selected_item = imgui.ImInt(0)
style.WindowRounding = ЗАКРУГЛЕНИЕ
imgui.SwitchContext()
themes.SwitchColorTheme()
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Script {8A2BE2}loaded!', -1)
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Activation: {8A2BE2}/advh', -1)
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Author: {8A2BE2}goose', -1)
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand('advh', function()
mm.v = not mm.v
imgui.Process =mm.v
end)
wait(-1)
end
function imgui.OnDrawFrame()
imgui.SetNextWindowSize(imgui.ImVec2(300, 225))
imgui.Begin('ADVHelper by goose')
if imgui.Button('Информация') then
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Version:{8A2BE2} 1.0 {FFFFFF}({8A2BE2}28.11.2023{FFFFFF})', -1)
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Author: {8A2BE2}goose {FFFFFF}| {8A2BE2}VK{FFFFFF}: {8A2BE2}@nekazav', -1)
end
if imgui.Combo('Выбор темы', selected_item, {'Синяя тема', 'Красная тема', 'Оранжевая тема', 'Голубая тема', 'Черная тема', 'Фиолетовая тема'}, 6) then
if selected_item.v == 0 then
imgui.SwitchContext()
themes.SwitchColorTheme(1)
end
if selected_item.v == 1 then
imgui.SwitchContext()
themes.SwitchColorTheme(2)
end
if selected_item.v == 2 then
imgui.SwitchContext()
themes.SwitchColorTheme(3)
end
if selected_item.v == 3 then
imgui.SwitchContext()
themes.SwitchColorTheme(4)
end
if selected_item.v == 4 then
imgui.SwitchContext()
themes.SwitchColorTheme(5)
end
if selected_item.v == 5 then
imgui.SwitchContext()
themes.SwitchColorTheme(6)
end
end
imgui.SetNextWindowSize(imgui.ImVec2(250, 225))
imgui.SetCursorPosX(5)
imgui.SetCursorPosY(210)
imgui.Text(os.date('%H:%M:%S'))
imgui.SetCursorPosX(225)
imgui.SetCursorPosY(210)
imgui.Text('Version: 1.0')
imgui.End()
end
local themes = import "resourse/imgui_themes.lua"
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local arr = os.date("*t")
local mm = imgui.ImBool(false)
local style = imgui.GetStyle()
local radio = imgui.ImInt(0)
selected_item = imgui.ImInt(0)
style.WindowRounding = ЗАКРУГЛЕНИЕ
imgui.SwitchContext()
themes.SwitchColorTheme()
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Script {8A2BE2}loaded!', -1)
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Activation: {8A2BE2}/advh', -1)
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Author: {8A2BE2}goose', -1)
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand('advh', function()
mm.v = not mm.v
imgui.Process =mm.v
end)
wait(-1)
end
function imgui.OnDrawFrame()
imgui.SetNextWindowSize(imgui.ImVec2(300, 225))
imgui.Begin('ADVHelper by goose')
if imgui.Button('Информация') then
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Version:{8A2BE2} 1.0 {FFFFFF}({8A2BE2}28.11.2023{FFFFFF})', -1)
sampAddChatMessage('{FFFFFF}[{8A2BE2} ADVH {FFFFFF}] Author: {8A2BE2}goose {FFFFFF}| {8A2BE2}VK{FFFFFF}: {8A2BE2}@nekazav', -1)
end
if imgui.Combo('Выбор темы', selected_item, {'Синяя тема', 'Красная тема', 'Оранжевая тема', 'Голубая тема', 'Черная тема', 'Фиолетовая тема'}, 6) then
if selected_item.v == 0 then
imgui.SwitchContext()
themes.SwitchColorTheme(1)
end
if selected_item.v == 1 then
imgui.SwitchContext()
themes.SwitchColorTheme(2)
end
if selected_item.v == 2 then
imgui.SwitchContext()
themes.SwitchColorTheme(3)
end
if selected_item.v == 3 then
imgui.SwitchContext()
themes.SwitchColorTheme(4)
end
if selected_item.v == 4 then
imgui.SwitchContext()
themes.SwitchColorTheme(5)
end
if selected_item.v == 5 then
imgui.SwitchContext()
themes.SwitchColorTheme(6)
end
end
imgui.SetNextWindowSize(imgui.ImVec2(250, 225))
imgui.SetCursorPosX(5)
imgui.SetCursorPosY(210)
imgui.Text(os.date('%H:%M:%S'))
imgui.SetCursorPosX(225)
imgui.SetCursorPosY(210)
imgui.Text('Version: 1.0')
imgui.End()
end
UPD: обновил код
Последнее редактирование: