Акт./Деак. имгуи - Lua Code

Vespan

loneliness
Автор темы
Проверенный
2,105
1,639
Мне надо код,что когда пишу команду /test появлялся окошко имгуи(такое
39161
)
 
Решение
Да, говнокод, ну и что)))) Кто скажет как сделать было проще - тот молодец
Там есть код,но имгуи появляеться СРАЗУ после старта сампа,а мне нада что-бы акт.и деак. через команду
Lua:
local imgui = require 'imgui'
scron = false

function main()
 if not isSampfuncsLoaded() or not isSampLoaded() then return end
 while not isSampAvailable() do wait(100) end
 sampRegisterChatCommand("test", test)
 wait(-1)
end
-- --
function test()
scron = not scron
    if scron then
        sampAddChatMessage("вкл", -1)
        imgui.Process = true
    else
        sampAddChatMessage("выкл", -1)
        imgui.Process = false
    end
end

function imgui.OnDrawFrame()
  imgui.Begin('My window') -- новое окно с заголовком 'My window'
  imgui.Text('Hello...

stranger_karelli

Потрачен
382
262
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
 

Vespan

loneliness
Автор темы
Проверенный
2,105
1,639
в else
imgui.Begin('My window')
Можно просто код готовый
 

Vespan

loneliness
Автор темы
Проверенный
2,105
1,639

BlackGoblin

Известный
519
215
Да, говнокод, ну и что)))) Кто скажет как сделать было проще - тот молодец
Там есть код,но имгуи появляеться СРАЗУ после старта сампа,а мне нада что-бы акт.и деак. через команду
Lua:
local imgui = require 'imgui'
scron = false

function main()
 if not isSampfuncsLoaded() or not isSampLoaded() then return end
 while not isSampAvailable() do wait(100) end
 sampRegisterChatCommand("test", test)
 wait(-1)
end
-- --
function test()
scron = not scron
    if scron then
        sampAddChatMessage("вкл", -1)
        imgui.Process = true
    else
        sampAddChatMessage("выкл", -1)
        imgui.Process = false
    end
end

function imgui.OnDrawFrame()
  imgui.Begin('My window') -- новое окно с заголовком 'My window'
  imgui.Text('Hello world') -- простой текст внутри этого окна
  imgui.End() -- конец окна
end
 

Vespan

loneliness
Автор темы
Проверенный
2,105
1,639
Да, говнокод, ну и что)))) Кто скажет как сделать было проще - тот молодец

Lua:
local imgui = require 'imgui'
scron = false

function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("test", test)
wait(-1)
end
-- --
function test()
scron = not scron
    if scron then
        sampAddChatMessage("вкл", -1)
        imgui.Process = true
    else
        sampAddChatMessage("выкл", -1)
        imgui.Process = false
    end
end

function imgui.OnDrawFrame()
  imgui.Begin('My window') -- новое окно с заголовком 'My window'
  imgui.Text('Hello world') -- простой текст внутри этого окна
  imgui.End() -- конец окна
end
А можешь мне добавить крестик на который закроеться окно

Lua:
local imgui = require 'imgui'
scron = false

function main()
 if not isSampfuncsLoaded() or not isSampLoaded() then return end
 while not isSampAvailable() do wait(100) end
 sampRegisterChatCommand("test", test)
 wait(-1)
end
-- --
function test()
scron = not scron
    if scron then
        sampAddChatMessage("вкл", -1)
        imgui.Process = true
    else
        sampAddChatMessage("выкл", -1)
        imgui.Process = false
    end
end

function imgui.OnDrawFrame()
  imgui.Begin('My window') -- новое окно с заголовком 'My window'
  imgui.Text('Hello world') -- простой текст внутри этого окна
    imgui.Text('123')
    if imgui.Button('Press Me') then
        sampAddChatMessage('test', -1)
    end
    imgui.End() -- конец окна
end
 
Последнее редактирование: