g.CurrentWindowStack.Size == 1

Статус
В этой теме нельзя размещать новые ответы.

ReoGenT

Участник
Автор темы
90
6
Версия MoonLoader
.026-beta
В чем проблема, раньше этой ошибки не было!

Я только понял, что это из-за samp events, но он в моем скрипте очень важен и скрипт без него не будет работать!

Вот часть скрипта из-за которого возможно крашит:
Lua:
local remenu = imgui.ImBool(false)
local kick = imgui.ImBuffer(256)
local ban = imgui.ImBuffer(257)

function on.onSendCommand(text)
    if text:find('/re (%d+)') then
        id = text:match('(%d+)')
        idys = id
    end
end

function imgui.OnDrawFrame()

imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4

style.Alpha = 1.0
style.ChildWindowRounding = 3
style.WindowRounding = 3
style.GrabRounding = 1
style.GrabMinSize = 20
style.FrameRounding = 3

colors[clr.Text] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.TextDisabled] = ImVec4(0.00, 0.40, 0.41, 1.00)
colors[clr.WindowBg] = ImVec4(0.00, 0.00, 0.00, 0.80)
colors[clr.ChildWindowBg] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.Border] = ImVec4(0.00, 1.00, 1.00, 0.65)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.44, 0.80, 0.80, 0.18)
colors[clr.FrameBgHovered] = ImVec4(0.44, 0.80, 0.80, 0.27)
colors[clr.FrameBgActive] = ImVec4(0.44, 0.81, 0.86, 0.66)
colors[clr.TitleBg] = ImVec4(0.14, 0.18, 0.21, 0.73)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.54)
colors[clr.TitleBgActive] = ImVec4(0.00, 1.00, 1.00, 0.27)
colors[clr.MenuBarBg] = ImVec4(0.00, 0.00, 0.00, 0.20)
colors[clr.ScrollbarBg] = ImVec4(0.22, 0.29, 0.30, 0.71)
colors[clr.ScrollbarGrab] = ImVec4(0.00, 1.00, 1.00, 0.44)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
colors[clr.ScrollbarGrabActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.ComboBg] = ImVec4(0.16, 0.24, 0.22, 0.60)
colors[clr.CheckMark] = ImVec4(0.00, 1.00, 1.00, 0.68)
colors[clr.SliderGrab] = ImVec4(0.00, 1.00, 1.00, 0.36)
colors[clr.SliderGrabActive] = ImVec4(0.00, 1.00, 1.00, 0.76)
colors[clr.Button] = ImVec4(0.00, 0.65, 0.65, 0.46)
colors[clr.ButtonHovered] = ImVec4(0.01, 1.00, 1.00, 0.43)
colors[clr.ButtonActive] = ImVec4(0.00, 1.00, 1.00, 0.62)
colors[clr.Header] = ImVec4(0.00, 1.00, 1.00, 0.33)
colors[clr.HeaderHovered] = ImVec4(0.00, 1.00, 1.00, 0.42)
colors[clr.HeaderActive] = ImVec4(0.00, 1.00, 1.00, 0.54)
colors[clr.ResizeGrip] = ImVec4(0.00, 1.00, 1.00, 0.54)
colors[clr.ResizeGripHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
colors[clr.ResizeGripActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.CloseButton] = ImVec4(0.00, 0.78, 0.78, 0.72)
colors[clr.CloseButtonHovered] = ImVec4(0.00, 0.78, 0.78, 0.42)
colors[clr.CloseButtonActive] = ImVec4(0.00, 0.78, 0.78, 0.80)
colors[clr.PlotLines] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.00, 1.00, 1.00, 0.22)
colors[clr.ModalWindowDarkening] = ImVec4(0.04, 0.10, 0.09, 0.51)

    if remenu.v then
        if isKeyJustPressed(key.VK_RBUTTON) and not sampIsChatInputActive() and not sampIsDialogActive() then
            imgui.ShowCursor = not imgui.ShowCursor
        end
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / -1.8, sh / 1.4), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(250, 370), imgui.Cond.FirstUseEver)
        imgui.Begin(u8'Меню слежки', remenu, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)
        imgui.TextColoredRGB('ID игрока: '.. idys)
        if imgui.Button(u8'Отправить на спавн') then
            sampSendChat('/gotosp '..idys)
        end
        if imgui.Button(u8'Проверка на GM') then
            sampSendChat('/gm '..idys)
        end
        if imgui.Button(u8'Статистика игрока') then
            sampSendChat('/getstats '..idys)
        end
        if imgui.Button(u8'Получить IP игрока') then
            sampSendChat('/getip '..idys)
        end
        if imgui.Button(u8'Забанить за читы') then
            sampSendChat('ban '..idys..' 30 Читы')
        end
        imgui.TextColoredRGB('Причина кика:')
        imgui.InputText(u8' ##1', kick)
        if imgui.Button(u8'Кикнуть') then
            sampSendChat('kick '..idys..' '..kick.v)
        end
        imgui.TextColoredRGB('Причина бана:')
        imgui.InputText(u8' ##2', ban)
        if imgui.Button(u8'Забанить') then
            sampSendChat('ban '..idys..' '..ban.v)
        end
        if imgui.Button(u8'Отключить слежку') then
            sampSendChat('/re')
            remenu.v = false
        end
    end
end

function on.onShowMenu()
    if remenu.v then
        return false
    end
end

function on.onHideMenu()
    if remenu.v then
        return false
    end
end
Снимок экрана 2022-05-31 183124.png
 
Решение
всё очень плохо
Lua:
local remenu = imgui.ImBool(false)
local kick = imgui.ImBuffer(256)
local ban = imgui.ImBuffer(257)

function imgui.OnDrawFrame()
    if remenu.v then
        if isKeyJustPressed(key.VK_RBUTTON) and not sampIsChatInputActive() and not sampIsDialogActive() then
            imgui.ShowCursor = not imgui.ShowCursor
        end
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / -1.8, sh / 1.4), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(250, 370), imgui.Cond.FirstUseEver)
        imgui.Begin(u8'Меню слежки', remenu, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)...

#Northn

Police Helper «Reborn» — уже ШЕСТЬ лет!
Всефорумный модератор
2,635
2,486
всё очень плохо
Lua:
local remenu = imgui.ImBool(false)
local kick = imgui.ImBuffer(256)
local ban = imgui.ImBuffer(257)

function imgui.OnDrawFrame()
    if remenu.v then
        if isKeyJustPressed(key.VK_RBUTTON) and not sampIsChatInputActive() and not sampIsDialogActive() then
            imgui.ShowCursor = not imgui.ShowCursor
        end
        local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / -1.8, sh / 1.4), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(250, 370), imgui.Cond.FirstUseEver)
        imgui.Begin(u8'Меню слежки', remenu, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)
        imgui.TextColoredRGB('ID игрока: '.. idys)
        if imgui.Button(u8'Отправить на спавн') then
            sampSendChat('/gotosp '..idys)
        end
        if imgui.Button(u8'Проверка на GM') then
            sampSendChat('/gm '..idys)
        end
        if imgui.Button(u8'Статистика игрока') then
            sampSendChat('/getstats '..idys)
        end
        if imgui.Button(u8'Получить IP игрока') then
            sampSendChat('/getip '..idys)
        end
        if imgui.Button(u8'Забанить за читы') then
            sampSendChat('ban '..idys..' 30 Читы')
        end
        imgui.TextColoredRGB('Причина кика:')
        imgui.InputText(u8' ##1', kick)
        if imgui.Button(u8'Кикнуть') then
            sampSendChat('kick '..idys..' '..kick.v)
        end
        imgui.TextColoredRGB('Причина бана:')
        imgui.InputText(u8' ##2', ban)
        if imgui.Button(u8'Забанить') then
            sampSendChat('ban '..idys..' '..ban.v)
        end
        if imgui.Button(u8'Отключить слежку') then
            sampSendChat('/re')
            remenu.v = false
        end
        imgui.End()
    end
end

function on.onShowMenu()
    if remenu.v then
        return false
    end
end

function on.onHideMenu()
    if remenu.v then
        return false
    end
end

function on.onSendCommand(text)
    if text:find('/re (%d+)') then
        id = text:match('(%d+)')
        idys = id
    end
end

do
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    style.Alpha = 1.0
    style.ChildWindowRounding = 3
    style.WindowRounding = 3
    style.GrabRounding = 1
    style.GrabMinSize = 20
    style.FrameRounding = 3

    colors[clr.Text] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled] = ImVec4(0.00, 0.40, 0.41, 1.00)
    colors[clr.WindowBg] = ImVec4(0.00, 0.00, 0.00, 0.80)
    colors[clr.ChildWindowBg] = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.Border] = ImVec4(0.00, 1.00, 1.00, 0.65)
    colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg] = ImVec4(0.44, 0.80, 0.80, 0.18)
    colors[clr.FrameBgHovered] = ImVec4(0.44, 0.80, 0.80, 0.27)
    colors[clr.FrameBgActive] = ImVec4(0.44, 0.81, 0.86, 0.66)
    colors[clr.TitleBg] = ImVec4(0.14, 0.18, 0.21, 0.73)
    colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.54)
    colors[clr.TitleBgActive] = ImVec4(0.00, 1.00, 1.00, 0.27)
    colors[clr.MenuBarBg] = ImVec4(0.00, 0.00, 0.00, 0.20)
    colors[clr.ScrollbarBg] = ImVec4(0.22, 0.29, 0.30, 0.71)
    colors[clr.ScrollbarGrab] = ImVec4(0.00, 1.00, 1.00, 0.44)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
    colors[clr.ScrollbarGrabActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.ComboBg] = ImVec4(0.16, 0.24, 0.22, 0.60)
    colors[clr.CheckMark] = ImVec4(0.00, 1.00, 1.00, 0.68)
    colors[clr.SliderGrab] = ImVec4(0.00, 1.00, 1.00, 0.36)
    colors[clr.SliderGrabActive] = ImVec4(0.00, 1.00, 1.00, 0.76)
    colors[clr.Button] = ImVec4(0.00, 0.65, 0.65, 0.46)
    colors[clr.ButtonHovered] = ImVec4(0.01, 1.00, 1.00, 0.43)
    colors[clr.ButtonActive] = ImVec4(0.00, 1.00, 1.00, 0.62)
    colors[clr.Header] = ImVec4(0.00, 1.00, 1.00, 0.33)
    colors[clr.HeaderHovered] = ImVec4(0.00, 1.00, 1.00, 0.42)
    colors[clr.HeaderActive] = ImVec4(0.00, 1.00, 1.00, 0.54)
    colors[clr.ResizeGrip] = ImVec4(0.00, 1.00, 1.00, 0.54)
    colors[clr.ResizeGripHovered] = ImVec4(0.00, 1.00, 1.00, 0.74)
    colors[clr.ResizeGripActive] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.CloseButton] = ImVec4(0.00, 0.78, 0.78, 0.72)
    colors[clr.CloseButtonHovered] = ImVec4(0.00, 0.78, 0.78, 0.42)
    colors[clr.CloseButtonActive] = ImVec4(0.00, 0.78, 0.78, 0.80)
    colors[clr.PlotLines] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotLinesHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogram] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(0.00, 1.00, 1.00, 1.00)
    colors[clr.TextSelectedBg] = ImVec4(0.00, 1.00, 1.00, 0.22)
    colors[clr.ModalWindowDarkening] = ImVec4(0.04, 0.10, 0.09, 0.51)
end
 
Статус
В этой теме нельзя размещать новые ответы.