Помогите сделать вкл/выкл окна имгуя по кнопке

Corenale

Известный
Автор темы
147
153
Версия MoonLoader
.026-beta
Помогите сделать вкл/выкл окна имгуя по кнопке
 

qdIbp

Автор темы
Проверенный
1,386
1,141
Помогите сделать вкл/выкл окна имгуя по кнопке
Lua:
--Типа этого?
require "lib.moonloader"
require 'lib.vkeys'
local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        imgui.Begin('My window', main_window_state)
            imgui.Text('Hello world')
        imgui.End()
    end
end

function main()
    while true do wait(0)
        if wasKeyPressed(VK_X) and not isSampfuncsConsoleActive() and not sampIsChatInputActive() and not isPauseMenuActive() then -- активация по нажатию клавиши X + Проверка открыты ли Сампфункс, чат, и пауза(esc)
            main_window_state.v = not main_window_state.v
        end
        imgui.Process = main_window_state.v -- теперь значение imgui.Process всегда будет задаваться в зависимости от активности основного окна
    end
end
 
Последнее редактирование:
  • Bug
Реакции: Corenale

qdIbp

Автор темы
Проверенный
1,386
1,141
Corenalka ;):
local imgui = require 'imgui'
local encoding = require 'encoding'
local key = require('vkeys')
encoding.default = 'CP1251'
u8 = encoding.UTF8

local title = imgui.ImBool(false)

function main()
    repeat wait(0) until isSampAvailable()
    if wasKeyPressed(key.VK_INSERT) then
        title.v = not title.v
    end
    while true do
        wait(0)
        imgui.Process = title.v and true
    end
end

function imgui.OnDrawFrame()
    if title.v then
        imgui.SetNextWindowPos(imgui.ImVec2(350.0, 250.0), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(280.0, 70.0), imgui.Cond.FirstUseEver)
        imgui.Begin('Corenale Hack!', title)

        if Button(u8"ВЗЛОМАТЬ ПИНТАГОН!") then
        end

        imgui.End()
    end
end


выйди розбiйник с этого раздела.
Чел у тя ошибка в 26 строке
будет правильней
Lua:
if imgui.Button(u8"ВЗЛОМАТЬ ПИНТАГОН!") then
end

И тем более проверка нажатие клавиши вне беск.цикла

Мне не сильно охота ругаться но разница в коде который я скинул и который у тебя минимальный, смысл один и тот же, но название Begin и нажатие кнопки разные
 

qdIbp

Автор темы
Проверенный
1,386
1,141
Tvoy toje ne raboet, ne pizdi.
У меня всего лишь лишний and Был, сейчас его нету

Lua:
--Типа этого?
require "lib.moonloader"
require 'lib.vkeys'
local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        imgui.Begin('My window', main_window_state)
            imgui.Text('Hello world')
        imgui.End()
    end
end

function main()
    while true do wait(0)
        if wasKeyPressed(VK_X) and not isSampfuncsConsoleActive() and not sampIsChatInputActive() and not isPauseMenuActive() then -- активация по нажатию клавиши X + Проверка открыты ли Сампфункс, чат, и пауза(esc)
            main_window_state.v = not main_window_state.v
        end
        imgui.Process = main_window_state.v -- теперь значение imgui.Process всегда будет задаваться в зависимости от активности основного окна
    end
end
отредактировано, можно проверять
 

[w0te]

Потрачен
771
487
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Lua:
--Типа этого?
require "lib.moonloader"
require 'lib.vkeys'
local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        imgui.Begin('My window', main_window_state)
            imgui.Text('Hello world')
        imgui.End()
    end
end

function main()
    while true do wait(0)
        if wasKeyPressed(VK_X) and not isSampfuncsConsoleActive() and not sampIsChatInputActive() and not isPauseMenuActive() then -- активация по нажатию клавиши X + Проверка открыты ли Сампфункс, чат, и пауза(esc)
            main_window_state.v = not main_window_state.v
        end
        imgui.Process = main_window_state.v -- теперь значение imgui.Process всегда будет задаваться в зависимости от активности основного окна
    end
end
@Corenale - Бери код у него, я не ебу хули у меня ошибка комплятор даже не ругается.
 

ik0nka

Известный
749
344
код:
local imgui = require 'imgui'
local encoding = require 'encoding'
local vkeys = require 'vkeys'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.ImBool(false)

function main()
    while not isSampAvailable() do wait(200) end
    imgui.Process = false
    while true do
        wait(0)
        imgui.Process = window.v
        if isKeyDown(0x72) then
            window.v = not window.v
        end
    end
end

function imgui.OnDrawFrame()
    if window.v then
        imgui.SetNextWindowPos(imgui.ImVec2(350.0, 250.0), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(280.0, 70.0), imgui.Cond.FirstUseEver)
        imgui.Begin('Window Title', window)

        

        imgui.End()
    end
end
F3 – открыть меню
 

qdIbp

Автор темы
Проверенный
1,386
1,141
@Corenale - Бери код у него, я не ебу хули у меня ошибка комплятор даже не ругается.
Lua:
--Попробуй *твой код*
local imgui = require 'imgui'
local encoding = require 'encoding'
local key = require('vkeys')
encoding.default = 'CP1251'
u8 = encoding.UTF8

local title = imgui.ImBool(false)

function main()
    repeat wait(0) until isSampAvailable()
   
    while true do wait(0)
    if wasKeyPressed(key.VK_INSERT) then title.v = not title.v end
        imgui.Process = title.v and true
    end
end

function imgui.OnDrawFrame()
    if title.v then
        imgui.SetNextWindowPos(imgui.ImVec2(350.0, 250.0), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(280.0, 70.0), imgui.Cond.FirstUseEver)
        imgui.Begin('Corenale Hack!', title)
            if imgui.Button(u8"ВЗЛОМАТЬ ПИНТАГОН!") then end
        imgui.End()
    end
end