Как не дать имгуи окну открываться при вводе текста в чат

DedPoet

Участник
Автор темы
98
18
Версия MoonLoader
Другое
Всем привет! У меня проблема со скриптом.
Клавиша активации у меня на 0. И при вводе цифры в окне набора текста (Т/F6), то открывается окно и становится неудобно.
Как можно это запретить?
code:
function main()
    if not isSampLoaded() and not isSampfuncsLoaded() and not sampIsDialogActive() and not sampIsChatInputActive() then return end
    while not isSampAvailable() do wait(150) end
        sampAddChatMessage("{FFF000}[Connect]{FFFFFF} Загружен")
        sampAddChatMessage("{FFF000}[Connect]{FFFFFF}{FFFFFF} Команда активации:{FF0000} /rc")
        sampRegisterChatCommand("rc", brconnectimgui)
    while true do
        wait(0)
        if wasKeyPressed(key.VK_0) then --(key.VK_(Желаемую кнопку))
            main_window_state.v = not main_window_state.v
        end
        imgui.Process = main_window_state.v
        
        --if wasKeyPressed(key.VK_9) then
            --secondary_window_state.v = not secondary_window_state.v
        --end
        
        --imgui.Process = secondary_window_state.v
    end
    
end

function imgui.OnDrawFrame()

    if not main_window_state.v then
        imgui.Process = false
    end
    

    if main_window_state.v then
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(385, 400), imgui.Cond.FirstUseEver)

        imgui.Begin(u8'Connect', nil, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoMove)
        imgui.Text(u8("Развлекаловка"))
        imgui.Text(u8("ауе"))
        imgui.Text(u8("текст"))
        imgui.Text(u8("Автор скрипта: dedpoet"))
        imgui.BeginChild('right', imgui.ImVec2(390, 280), true)
        imgui.Indent(1)
        if imgui.Button(u8'REDROCK', imgui.ImVec2(260,25)) then RED() end
        imgui.SameLine()
        if imgui.Button(u8'Сайт cервера##http://redrock.online', imgui.ImVec2(88,25)) then
            os.execute("start http://redrock.online")
    imgui.EndChild()
    imgui.End()
end
 

манку хлебал

Потрачен
305
121
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Lua:
function main()
    if not isSampLoaded() and not isSampfuncsLoaded() and not sampIsDialogActive() and not sampIsChatInputActive() then return end
    while not isSampAvailable() do wait(150) end
        sampAddChatMessage("{FFF000}[Connect]{FFFFFF} Загружен")
        sampAddChatMessage("{FFF000}[Connect]{FFFFFF}{FFFFFF} Команда активации:{FF0000} /rc")
        sampRegisterChatCommand("rc", brconnectimgui)
    while true do
        wait(0)
        if wasKeyPressed(key.VK_0) and not isAnySampWindowOpened() then --(key.VK_(Желаемую кнопку))
            main_window_state.v = not main_window_state.v
        end
        imgui.Process = main_window_state.v
        
        --if wasKeyPressed(key.VK_9) then
            --secondary_window_state.v = not secondary_window_state.v
        --end
        
        --imgui.Process = secondary_window_state.v
    end
    
end

function imgui.OnDrawFrame()

    if not main_window_state.v then
        imgui.Process = false
    end
    

    if main_window_state.v then
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(385, 400), imgui.Cond.FirstUseEver)

        imgui.Begin(u8'Connect', nil, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoMove)
        imgui.Text(u8("Развлекаловка"))
        imgui.Text(u8("ауе"))
        imgui.Text(u8("текст"))
        imgui.Text(u8("Автор скрипта: dedpoet"))
        imgui.BeginChild('right', imgui.ImVec2(390, 280), true)
        imgui.Indent(1)
        if imgui.Button(u8'REDROCK', imgui.ImVec2(260,25)) then RED() end
        imgui.SameLine()
        if imgui.Button(u8'Сайт cервера##http://redrock.online', imgui.ImVec2(88,25)) then
            os.execute("start http://redrock.online")
    imgui.EndChild()
    imgui.End()
end


function isAnySampWindowOpened()
    return sampIsScoreboardOpen() or sampIsChatVisible() or sampIsDialogActive() or isPauseMenuActive() 
end