краш wait

лион из бровл сторс

Участник
Автор темы
140
13
Версия MoonLoader
.026-beta
x4uJINv.png

2 мимгуй(имгуй) меню, хотя должно быть одно
Код:
imgui.OnFrame(function() return window[0] end, function(self)
    local sizeX, sizeY = getScreenResolution()
    imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(695, 555), imgui.Cond.FirstUseEver)
    imgui.Begin(sampGetPlayerNickname(playerId).."["..playerId.."]", window)
    for k, v in ipairs(cCode) do
        lua_thread.create(function()
        for header, l in pairs(v) do
            if imgui.CollapsingHeader(u8(header)) then
                for _, reason in pairs(l) do
                    if imgui.Button(u8(reason[2]), imgui.ImVec2(-1, 20)) then
                        sampSendChat("/me зажав кнопку на нагрудной рации, запросил объявить в розыск человека")
                        window[0] = false
                        wait(1000)
                        sampAddChatMessage(string.format("/me "..playerId.." "..reason[3].." "..reason[1].." ЕФК", sampGetPlayerNickname(playerId), playerId, reason[3], reason[1]), -1)
                        end
                    end
                end
            end
        end)
    imgui.End()
end
end)
Если убрать
Код:
        lua_thread.create(function()
то с окнами нормально будет, но будет крашится на wait(1000)
 

Corenale

Известный
147
153
x4uJINv.png

2 мимгуй(имгуй) меню, хотя должно быть одно
Код:
imgui.OnFrame(function() return window[0] end, function(self)
    local sizeX, sizeY = getScreenResolution()
    imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(695, 555), imgui.Cond.FirstUseEver)
    imgui.Begin(sampGetPlayerNickname(playerId).."["..playerId.."]", window)
    for k, v in ipairs(cCode) do
        lua_thread.create(function()
        for header, l in pairs(v) do
            if imgui.CollapsingHeader(u8(header)) then
                for _, reason in pairs(l) do
                    if imgui.Button(u8(reason[2]), imgui.ImVec2(-1, 20)) then
                        sampSendChat("/me зажав кнопку на нагрудной рации, запросил объявить в розыск человека")
                        window[0] = false
                        wait(1000)
                        sampAddChatMessage(string.format("/me "..playerId.." "..reason[3].." "..reason[1].." ЕФК", sampGetPlayerNickname(playerId), playerId, reason[3], reason[1]), -1)
                        end
                    end
                end
            end
        end)
    imgui.End()
end
end)
Если убрать
Код:
        lua_thread.create(function()
то с окнами нормально будет, но будет крашится на wait(1000)
21 и 22 строку местами поменяй..
 

Andrinall

Известный
679
532
Смысл есть.
А вот в чём смысл string.format у тебя, если ты юзаешь конкатенацию, я вообще не понял...
Lua:
imgui.OnFrame(function() return window[0] end, function(self)
    local sizeX, sizeY = getScreenResolution()
    imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(695, 555), imgui.Cond.FirstUseEver)
    imgui.Begin(sampGetPlayerNickname(playerId).."["..playerId.."]", window)
    for k, v in ipairs(cCode) do
        for header, l in pairs(v) do
            if imgui.CollapsingHeader(u8(header)) then
                for _, reason in pairs(l) do
                    if imgui.Button(u8(reason[2]), imgui.ImVec2(-1, 20)) then
                        lua_thread.create(function()
                            sampSendChat("/me зажав кнопку на нагрудной рации, запросил объявить в розыск человека")
                            window[0] = false
                            wait(1000)
                            sampAddChatMessage(string.format("/me "..playerId.." "..reason[3].." "..reason[1].." ЕФК", sampGetPlayerNickname(playerId), playerId, reason[3], reason[1]), -1)
                        end)
                    end
                end
            end
        end
    end
    imgui.End()
end)