Как сделать

abnomegd

Активный
Автор темы
335
35
Версия SA-MP
  1. 0.3.7 (R1)
Доброго времени суток.
Как убрать остальные 4 раздела чтобы осталось только 1 раздел, и чтобы в конце не было цифры.
И как избавиться от функции.
Вот код:
script:
require "lib.moonloader" -- подключение библиотеки
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local main_window_state = imgui.ImBool(false)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand("imgui", cmd_imgui)

    local placeholder = imgui.ImBool(false)

    imgui.Process = false

    -- Блок выполняется один раз после старта сампа

    while true do
        wait(0)

        if main_window_state.v == false then
            imgui.Process = false
        end
        -- Блок выполняющийся бесконечно (пока самп активен)

    end
end

function cmd_imgui(arg)
  main_window_state.v = not main_window_state.v
  imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()
  for i = 1, 5 do
    if imgui.CollapsingHeader(u8'Раздел #'..tostring(i)) then
        for i2 = 1, 3 do
            imgui.Checkbox(u8'Функция #'..tostring(i2), placeholder)
            imgui.Begin(u8"Привет", main_window_state)
        end
          imgui.End()
        end
    end
end
 

Gorskin

{Reverse Developer} ✓
Проверенный
1,256
1,059
Доброго времени суток.
Как убрать остальные 4 раздела чтобы осталось только 1 раздел, и чтобы в конце не было цифры.
И как избавиться от функции.
Вот код:
script:
require "lib.moonloader" -- подключение библиотеки
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local main_window_state = imgui.ImBool(false)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand("imgui", cmd_imgui)

    local placeholder = imgui.ImBool(false)

    imgui.Process = false

    -- Блок выполняется один раз после старта сампа

    while true do
        wait(0)

        if main_window_state.v == false then
            imgui.Process = false
        end
        -- Блок выполняющийся бесконечно (пока самп активен)

    end
end

function cmd_imgui(arg)
  main_window_state.v = not main_window_state.v
  imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()
  for i = 1, 5 do
    if imgui.CollapsingHeader(u8'Раздел #'..tostring(i)) then
        for i2 = 1, 3 do
            imgui.Checkbox(u8'Функция #'..tostring(i2), placeholder)
            imgui.Begin(u8"Привет", main_window_state)
        end
          imgui.End()
        end
    end
end
я так понимаю ты хочешь так:
require "lib.moonloader" -- подключение библиотеки
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local main_window_state = imgui.ImBool(false)

local sw, sh = getScreenResolution()

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand("imgui", cmd_imgui)

    local placeholder = imgui.ImBool(false)

    imgui.Process = false

    -- Блок выполняется один раз после старта сампа

    while true do
        wait(0)

        if main_window_state.v == false then
            imgui.Process = false
        end
        -- Блок выполняющийся бесконечно (пока самп активен)

    end
end

function cmd_imgui(arg)
  main_window_state.v = not main_window_state.v
  imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()
    imgui.SetNextWindowSize(imgui.ImVec2(290, 290), imgui.Cond.FirstUseEver)
    imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.Begin(u8"Название окна", main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        if imgui.CollapsingHeader(u8"Раздел") then
            imgui.Text("Text")
        end
    imgui.End()
end
 
  • Нравится
Реакции: abnomegd

abnomegd

Активный
Автор темы
335
35
я так понимаю ты хочешь так:
require "lib.moonloader" -- подключение библиотеки
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local main_window_state = imgui.ImBool(false)

local sw, sh = getScreenResolution()

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand("imgui", cmd_imgui)

    local placeholder = imgui.ImBool(false)

    imgui.Process = false

    -- Блок выполняется один раз после старта сампа

    while true do
        wait(0)

        if main_window_state.v == false then
            imgui.Process = false
        end
        -- Блок выполняющийся бесконечно (пока самп активен)

    end
end

function cmd_imgui(arg)
  main_window_state.v = not main_window_state.v
  imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()
    imgui.SetNextWindowSize(imgui.ImVec2(290, 290), imgui.Cond.FirstUseEver)
    imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.Begin(u8"Название окна", main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
        if imgui.CollapsingHeader(u8"Раздел") then
            imgui.Text("Text")
        end
    imgui.End()
end
спс это то что я искал