[mimgui] не открывается вкладка по коду

alexroq

Участник
Автор темы
109
12
Версия SA-MP
  1. 0.3.7-R3
Lua:
imgui.OnFrame(function() return windows.mainSettings[0] end, function()
    
    if imgui.Begin('News Helper - Настройки', isOpen, windowFlags) then
        
        if imgui.BeginTabBar('##MainTabs') then
            imgui.PushItemWidth(0)
            if fa_font then imgui.PushFont(fa_font) end
            
            local selectedTab = data.currentMainSettingsTab
            
            if imgui.BeginTabItem(fa('circle_info') .. ' О скрипте', nil,
                selectedTab == 0 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 0
                
                -- ...
                
                imgui.EndTabItem()
            end
            if fa_font then imgui.PushFont(fa_font) end
            
            if imgui.BeginTabItem(fa('gear') .. ' Настройки', nil,
                selectedTab == 1 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 1
                
                -- ...
                
                imgui.EndTabItem()
            end
            if fa_font then imgui.PushFont(fa_font) end
            
            if imgui.BeginTabItem(fa('key') .. ' Автологин', nil,
                selectedTab == 2 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 2
                
                -- ...
                
                imgui.EndTabItem()
            end
            if fa_font then imgui.PushFont(fa_font) end
            
            --
            if imgui.BeginTabItem(fa('keyboard') .. ' Биндер', nil,
                selectedTab == 3 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 3
                
                -- ...
                
                imgui.EndTabItem()
            end
            if fa_font then imgui.PushFont(fa_font) end
            
            --
            if imgui.BeginTabItem(fa('gamepad') .. ' Горячие клавиши', nil,
                selectedTab == 4 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 4
                
                -- ...
                
                imgui.EndTabItem()
            end
            if fa_font then imgui.PushFont(fa_font) end
            
            --
            if imgui.BeginTabItem(fa('users') .. ' Чекер', nil,
                selectedTab == 5 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 5
                
                -- ...
                
                imgui.EndTabItem()
            end
            if fa_font then imgui.PushFont(fa_font) end
            
            --
            if imgui.BeginTabItem(fa('microphone') .. ' Эфиры', nil,
                selectedTab == 6 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 6
                
                -- ...
                
                imgui.EndTabItem()
            end
            if fa_font then imgui.PushFont(fa_font) end
            
            --
            if imgui.BeginTabItem(fa('comment') .. ' Сообщения эфира', nil,
                selectedTab == 7 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 7
                
                -- ...
                
                imgui.EndTabItem()
            end
            if fa_font then imgui.PushFont(fa_font) end
            
            --
            if imgui.BeginTabItem(fa('tower_broadcast') .. ' Эфир без вопросов', nil,
                selectedTab == 8 and imgui.TabItemFlags.SetSelected or 0) then
                if fa_font then imgui.PopFont() end
                data.currentMainSettingsTab = 8
                
                -- ...
                
                imgui.EndTabItem()
            end
            
            imgui.PopItemWidth()
            imgui.EndTabBar()
            imgui.PopStyleColor(4)
            imgui.End()
        end
    end
end)
помогите есть такое окно с вкладками и короче например есть кнопка или команда допустим такая

Lua:
sampRegisterChatCommand('newsefir', function()
    data.currentMainSettingsTab = 6
    windows.mainSettings[0] = true
end)
мне бы хотелось чтобы открывало ну какую то вкладку но всегда открывается первая тоесть "О скрипте" я уже все перепробовал вообще не помогает
 

2elnwndrer.

Известный
151
56
второй способ с вкладками удмаю поможет понять