imgui окна

Radfgh177

Участник
Автор темы
62
1
Версия MoonLoader
.026-beta
Здравствуйте. Как сделать так чтобы при написании команды (/one) открывалось первое имгуи окно к примеру с текстом "Первое имгуи окно" а при написании команды (/two) открывалось второе имгуи окно с текстом "Второе имгуи окно"
 
Решение
[ML] (error) img.lua: Script died due to an error. (1C777E6C)
У меня все нормально

Наверное ты используешь старый ImGui, вот и умирает скрипт.
Lua:
local imgui = require 'imgui'
local fWindow, tWindow = imgui.ImBool(false), imgui.ImBool(false)

function main()
    sampRegisterChatCommand('one', function() fWindow.v = not fWindow.v end)
    sampRegisterChatCommand('two', function() tWindow.v = not tWindow.v end)
    while true do
        wait(0)
        imgui.Process = fWindow.v or tWindow.v
    end
end

function imgui.OnDrawFrame()
    if fWindow.v then
        imgui.Begin('One', fWindow)
        imgui.Text('Hello world')
        imgui.End()
    end
    if tWindow.v then
        imgui.Begin('Two', tWindow)...

PanSeek

t.me/dailypanseek
Всефорумный модератор
910
1,782
Lua:
local imgui = require 'mimgui'
local fWindow, tWindow = imgui.new.bool(false), imgui.new.bool(false)

function main()
    sampRegisterChatCommand('one', function() fWindow[0] = not fWindow[0] end)
    sampRegisterChatCommand('two', function() tWindow[0] = not tWindow[0] end)
    wait(-1)
end

local oneFrame = imgui.OnFrame(function() return fWindow[0] end, function(self)
    imgui.Begin('frame one', fWindow)
    imgui.Text('test')
    imgui.End()
end)

local twoFrame = imgui.OnFrame(function() return tWindow[0] end, function(self)
    imgui.Begin('frame two', tWindow)
    imgui.Text('test')
    imgui.End()
end)
 
  • Нравится
Реакции: James Saula

Radfgh177

Участник
Автор темы
62
1
Lua:
local imgui = require 'mimgui'
local fWindow, tWindow = imgui.new.bool(false), imgui.new.bool(false)

function main()
    sampRegisterChatCommand('one', function() fWindow[0] = not fWindow[0] end)
    sampRegisterChatCommand('two', function() tWindow[0] = not tWindow[0] end)
    wait(-1)
end

local oneFrame = imgui.OnFrame(function() return fWindow[0] end, function(self)
    imgui.Begin('frame one', fWindow)
    imgui.Text('test')
    imgui.End()
end)

local twoFrame = imgui.OnFrame(function() return tWindow[0] end, function(self)
    imgui.Begin('frame two', tWindow)
    imgui.Text('test')
    imgui.End()
end)
[ML] (error) img.lua: Script died due to an error. (1C777E6C)
 

PanSeek

t.me/dailypanseek
Всефорумный модератор
910
1,782
[ML] (error) img.lua: Script died due to an error. (1C777E6C)
У меня все нормально

Наверное ты используешь старый ImGui, вот и умирает скрипт.
Lua:
local imgui = require 'imgui'
local fWindow, tWindow = imgui.ImBool(false), imgui.ImBool(false)

function main()
    sampRegisterChatCommand('one', function() fWindow.v = not fWindow.v end)
    sampRegisterChatCommand('two', function() tWindow.v = not tWindow.v end)
    while true do
        wait(0)
        imgui.Process = fWindow.v or tWindow.v
    end
end

function imgui.OnDrawFrame()
    if fWindow.v then
        imgui.Begin('One', fWindow)
        imgui.Text('Hello world')
        imgui.End()
    end
    if tWindow.v then
        imgui.Begin('Two', tWindow)
        imgui.Text('Hello world')
        imgui.End()
    end
end
 
  • Нравится
Реакции: James Saula и Gorskin