ИмГуи Репорт

AngelMAILS228

Участник
Автор темы
79
7
Версия MoonLoader
.026-beta
Как сделать им гуи окно место диалога репорта, по типу такого?

48918


Что не так в коде?
Lua:
function reportper()
imgui.ShowCursor = true
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(400, 300), imgui.Cond.FirstUseEver)
imgui.Begin(u8"Жалоба/Вопрос##report", _, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoBringToFrontOnFocus+ imgui.WindowFlags.NoSavedSettings+imgui.WindowFlags.AlwaysAutoResize)
imgui.SetCursorPos(imgui.ImVec2(5, 25))
imgui.Text(u8('Жалоба от: '..nickreport..'['..idreport..']')) imgui.SameLine(); if imgui.Button(u8'Следить',imgui.ImVec2(54,18)) then
sampSendChat('/re '..idreport)
end
imgui.Separator()
        str2={}
        str3 = {}
        str4 = {}
    for i=0,#textreport+1 do
    str2[i] = textreport:sub(i,i)
    end
    zz=0
    for i,f in pairs(str2) do
    if zz >= 55 or i == #str2 then
    table.insert(str3,table.concat(str4,""))
    str4={}
    zz=0
    end
    zz=zz+1
    table.insert(str4,f)
    end
    for i,f in pairs(str3) do
if i == #str3 then
        tiretext = ''
    else
        tiretext = '-'
    end
 imgui.Text(u8(f..tiretext))
    end

            imgui.Separator()
                        imgui.Text(u8('Сохранить ответ в базу данных сервера? ')) imgui.SameLine();
                        imgui.ToggleButton(u8'##6546', getradio)
                                        imgui.Separator()
                        imgui.PushItemWidth(385) -- со значением играй
                        if imgui.IsWindowAppearing() then -- условие возвращает истину только один раз при открытии окна
    imgui.SetKeyboardFocusHere() -- устанавливает фокус на предыдущий итем
end
                imgui.InputText("##redsfdsfsd", inputreport)
                     imgui.PopItemWidth()
                                        imgui.Separator()

                                        if imgui.Button(u8('Слежу за наруш'),imgui.ImVec2(125,20)) then
if #reportidmass > 0 then
                                            sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
                                                    sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                                                                sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
                                                            sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90} Слежу', 0xCD5C5C)
                                                            sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo+1, 0xCD5C5C)
                                                    sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
                                                        settings.set.repkolvo = settings.set.repkolvo  + 1
                                            if #reportidmass == 1 then
                                                if sampIsPlayerConnected(reportidmass[1]) then
                                                        sampSendDialogResponse(reportiddialog, 1, _, 'Уважаемый игрок, начинаю работу по вашей жалобе!')
sampSendChat('/re '..reportidmass[1])
sampAddChatMessage('[Автоматическая слежка] Вы ушли в слежку за '..sampGetPlayerNickname(reportidmass[1])..'['..reportidmass[1]..']', 0xDF3535)
else
    sampSendDialogResponse(reportiddialog, 1, _, 'Уважаемый игрок, игрок на которого вы жалуетесь оффлайн!')
end
elseif #reportidmass > 1 then
                        sampSendDialogResponse(reportiddialog, 1, _, 'Уважаемый игрок, начинаю работу по вашей жалобе!')
sampSendChat('/re '..reportidmass[1])
        if sampIsPlayerConnected(reportidmass[1]) then
sampAddChatMessage('[Автоматическая слежка] Вы ушли в слежку за '..sampGetPlayerNickname(reportidmass[1])..'['..reportidmass[1]..'], в очереди '..#reportidmass..' нарушителей.', 0xDF3535)
else
    sampSendChat('/re '..reportidmass[2])
sampAddChatMessage('Игрок №1 Оффлайн.',0xDF3535)
sampAddChatMessage('[Автоматическая слежка] Вы ушли в слежку за '..sampGetPlayerNickname(reportidmass[2])..'['..reportidmass[2]..'], в очереди '..#reportidmass..' нарушителей.', 0xDF3535)
end
reportslejka.v = true
                                            end
                                            reportwindow.v = false
                                         imgui.ShowCursor = false
                                             imgui.LockPlayer = false
else
sampAddChatMessage('[Ошибка] В репорте не найдены ID',0xCDAD00)
                                         end
                                        end
                                        imgui.SameLine();
                                        if imgui.Button(u8('Помочь автору'),imgui.ImVec2(125,20)) then
sampSendDialogResponse(reportiddialog, 1, _, 'Уважаемый игрок, сейчас попробую вам помочь! Ожидайте.')
sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
    sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
            sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90}Уважаемый игрок, сейчас попробую вам помочь! Ожидайте.', 0xCD5C5C)
            sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo+1, 0xCD5C5C)
    sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
        settings.set.repkolvo = settings.set.repkolvo  + 1
sampSendChat('/re '..idreport)
reportwindow.v = false
imgui.ShowCursor = false
imgui.LockPlayer = false
                                        end
                        imgui.SameLine();
                    if imgui.Button(u8('Передать в /a чат'),imgui.ImVec2(125,20)) then
                                        inputreport.v = inputreport.v..u8'Уважаемый игрок, Передал ваш репорт администратору.'
                        str2={}
                        str3 = {}
                        str4 = {}
                    for i=0,#textreport+1 do
                    str2[i] = textreport:sub(i,i)
                    end

                    zz=0
                    for i,f in pairs(str2) do
                    if zz >= 57 or i == #str2 then
                    table.insert(str3,table.concat(str4,""))
                    str4={}
                    zz=0
                    end
                    zz=zz+1
                    table.insert(str4,f)
                    end
                    for i,f in pairs(str3) do
            if i == #str3 then
                        tiretext = ''
                    else
                        tiretext = '-'
                    end
                 sampSendChat('/a <<Репорт>> '..nickreport..'['..idreport..']: '..f..tiretext)
                    end
                end
if imgui.Button(u8('Подсказки /gps'),imgui.ImVec2(125,20)) then
gpslist.v  = true
reportwindow.v = false
end
imgui.SameLine();
if imgui.Button(u8('Подсказки по Работе [LVL]'),imgui.ImVec2(125,20)) then
pdskaz.v  = true
reportwindow.v = false
end
imgui.SameLine();
if imgui.Button(u8('На удачу'),imgui.ImVec2(125,20)) then
sampAddChatMessage('Вы нажали волшебную кнопку. Теперь все игроки будут ставить репутацию +', -1)
end
    imgui.Separator()

                reportenter = 0
for k , v in pairs(settings.reportname) do
if imgui.Button(u8(v),imgui.ImVec2(125,20)) then
if settings.reportstyle[k] == 0 then
if settings.reportotvet[k] ~= '' then
sampSendDialogResponse(reportiddialog, 1, _, settings.reportotvet[k])
sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
    sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
            sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90}'..settings.reportotvet[k], 0xCD5C5C)
            sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo+1, 0xCD5C5C)
    sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
        settings.set.repkolvo = settings.set.repkolvo  + 1
reportwindow.v = false
imgui.ShowCursor = false
imgui.LockPlayer = false
else
sampAddChatMessage('[Ошибка] Введите ответ. Либо закройте репорт.', 0xDF3535)
end
elseif settings.reportstyle[k] == 1 then
inputreport.v = inputreport.v..u8(settings.reportotvet[k])
end

end
reportenter = reportenter +1
if reportenter == 3 then
reportenter=0
else
if #settings.reportname ~= k then
imgui.SameLine();
end
end
end
                                imgui.PushStyleColor(imgui.Col.Button, imgui.ImColor(1, 300, 300, 113):GetVec4())
                                if imgui.Button(u8('Отправить'),imgui.ImVec2(125,20)) then
if inputreport.v ~= '' and inputreport.v ~= nil then
sampSendDialogResponse(reportiddialog, 1, _, u8:decode(inputreport.v))
reportwindow.v = false
imgui.ShowCursor = false
    imgui.LockPlayer = false
    sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
            sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                        sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
                    sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90}'..u8:decode(inputreport.v), 0xCD5C5C)
                    sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo+1, 0xCD5C5C)
            sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
                settings.set.repkolvo = settings.set.repkolvo  + 1
else
sampAddChatMessage('[Ошибка] Введите ответ. Либо закройте репорт.', 0xDF3535)
end
                            end

                                imgui.SameLine(264);
                                if imgui.Button(u8('Закрыть'),imgui.ImVec2(125,20)) then
                        sampSendDialogResponse(reportiddialog, 2, _, _)
                        sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
                                sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                                            sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
                                        sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90}-', 0xCD5C5C)
                                        sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo, 0xCD5C5C)
                                sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
                        reportwindow.v = false
                     imgui.ShowCursor = false
                         imgui.LockPlayer = false
                            end
                                imgui.PopStyleColor()
imgui.End()


end
 

Пайпер

Активный
232
46
 
  • Нравится
Реакции: kyrtion

|Il|Il|

Активный
407
70
в виде кода можно ?
 

Sadow

Известный
1,439
587
Как сделать им гуи окно место диалога репорта, по типу такого?

Посмотреть вложение 48918

Что не так в коде?
Lua:
function reportper()
imgui.ShowCursor = true
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(400, 300), imgui.Cond.FirstUseEver)
imgui.Begin(u8"Жалоба/Вопрос##report", _, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoBringToFrontOnFocus+ imgui.WindowFlags.NoSavedSettings+imgui.WindowFlags.AlwaysAutoResize)
imgui.SetCursorPos(imgui.ImVec2(5, 25))
imgui.Text(u8('Жалоба от: '..nickreport..'['..idreport..']')) imgui.SameLine(); if imgui.Button(u8'Следить',imgui.ImVec2(54,18)) then
sampSendChat('/re '..idreport)
end
imgui.Separator()
        str2={}
        str3 = {}
        str4 = {}
    for i=0,#textreport+1 do
    str2[i] = textreport:sub(i,i)
    end
    zz=0
    for i,f in pairs(str2) do
    if zz >= 55 or i == #str2 then
    table.insert(str3,table.concat(str4,""))
    str4={}
    zz=0
    end
    zz=zz+1
    table.insert(str4,f)
    end
    for i,f in pairs(str3) do
if i == #str3 then
        tiretext = ''
    else
        tiretext = '-'
    end
 imgui.Text(u8(f..tiretext))
    end

            imgui.Separator()
                        imgui.Text(u8('Сохранить ответ в базу данных сервера? ')) imgui.SameLine();
                        imgui.ToggleButton(u8'##6546', getradio)
                                        imgui.Separator()
                        imgui.PushItemWidth(385) -- со значением играй
                        if imgui.IsWindowAppearing() then -- условие возвращает истину только один раз при открытии окна
    imgui.SetKeyboardFocusHere() -- устанавливает фокус на предыдущий итем
end
                imgui.InputText("##redsfdsfsd", inputreport)
                     imgui.PopItemWidth()
                                        imgui.Separator()

                                        if imgui.Button(u8('Слежу за наруш'),imgui.ImVec2(125,20)) then
if #reportidmass > 0 then
                                            sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
                                                    sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                                                                sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
                                                            sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90} Слежу', 0xCD5C5C)
                                                            sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo+1, 0xCD5C5C)
                                                    sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
                                                        settings.set.repkolvo = settings.set.repkolvo  + 1
                                            if #reportidmass == 1 then
                                                if sampIsPlayerConnected(reportidmass[1]) then
                                                        sampSendDialogResponse(reportiddialog, 1, _, 'Уважаемый игрок, начинаю работу по вашей жалобе!')
sampSendChat('/re '..reportidmass[1])
sampAddChatMessage('[Автоматическая слежка] Вы ушли в слежку за '..sampGetPlayerNickname(reportidmass[1])..'['..reportidmass[1]..']', 0xDF3535)
else
    sampSendDialogResponse(reportiddialog, 1, _, 'Уважаемый игрок, игрок на которого вы жалуетесь оффлайн!')
end
elseif #reportidmass > 1 then
                        sampSendDialogResponse(reportiddialog, 1, _, 'Уважаемый игрок, начинаю работу по вашей жалобе!')
sampSendChat('/re '..reportidmass[1])
        if sampIsPlayerConnected(reportidmass[1]) then
sampAddChatMessage('[Автоматическая слежка] Вы ушли в слежку за '..sampGetPlayerNickname(reportidmass[1])..'['..reportidmass[1]..'], в очереди '..#reportidmass..' нарушителей.', 0xDF3535)
else
    sampSendChat('/re '..reportidmass[2])
sampAddChatMessage('Игрок №1 Оффлайн.',0xDF3535)
sampAddChatMessage('[Автоматическая слежка] Вы ушли в слежку за '..sampGetPlayerNickname(reportidmass[2])..'['..reportidmass[2]..'], в очереди '..#reportidmass..' нарушителей.', 0xDF3535)
end
reportslejka.v = true
                                            end
                                            reportwindow.v = false
                                         imgui.ShowCursor = false
                                             imgui.LockPlayer = false
else
sampAddChatMessage('[Ошибка] В репорте не найдены ID',0xCDAD00)
                                         end
                                        end
                                        imgui.SameLine();
                                        if imgui.Button(u8('Помочь автору'),imgui.ImVec2(125,20)) then
sampSendDialogResponse(reportiddialog, 1, _, 'Уважаемый игрок, сейчас попробую вам помочь! Ожидайте.')
sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
    sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
            sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90}Уважаемый игрок, сейчас попробую вам помочь! Ожидайте.', 0xCD5C5C)
            sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo+1, 0xCD5C5C)
    sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
        settings.set.repkolvo = settings.set.repkolvo  + 1
sampSendChat('/re '..idreport)
reportwindow.v = false
imgui.ShowCursor = false
imgui.LockPlayer = false
                                        end
                        imgui.SameLine();
                    if imgui.Button(u8('Передать в /a чат'),imgui.ImVec2(125,20)) then
                                        inputreport.v = inputreport.v..u8'Уважаемый игрок, Передал ваш репорт администратору.'
                        str2={}
                        str3 = {}
                        str4 = {}
                    for i=0,#textreport+1 do
                    str2[i] = textreport:sub(i,i)
                    end

                    zz=0
                    for i,f in pairs(str2) do
                    if zz >= 57 or i == #str2 then
                    table.insert(str3,table.concat(str4,""))
                    str4={}
                    zz=0
                    end
                    zz=zz+1
                    table.insert(str4,f)
                    end
                    for i,f in pairs(str3) do
            if i == #str3 then
                        tiretext = ''
                    else
                        tiretext = '-'
                    end
                 sampSendChat('/a <<Репорт>> '..nickreport..'['..idreport..']: '..f..tiretext)
                    end
                end
if imgui.Button(u8('Подсказки /gps'),imgui.ImVec2(125,20)) then
gpslist.v  = true
reportwindow.v = false
end
imgui.SameLine();
if imgui.Button(u8('Подсказки по Работе [LVL]'),imgui.ImVec2(125,20)) then
pdskaz.v  = true
reportwindow.v = false
end
imgui.SameLine();
if imgui.Button(u8('На удачу'),imgui.ImVec2(125,20)) then
sampAddChatMessage('Вы нажали волшебную кнопку. Теперь все игроки будут ставить репутацию +', -1)
end
    imgui.Separator()

                reportenter = 0
for k , v in pairs(settings.reportname) do
if imgui.Button(u8(v),imgui.ImVec2(125,20)) then
if settings.reportstyle[k] == 0 then
if settings.reportotvet[k] ~= '' then
sampSendDialogResponse(reportiddialog, 1, _, settings.reportotvet[k])
sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
    sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
            sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90}'..settings.reportotvet[k], 0xCD5C5C)
            sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo+1, 0xCD5C5C)
    sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
        settings.set.repkolvo = settings.set.repkolvo  + 1
reportwindow.v = false
imgui.ShowCursor = false
imgui.LockPlayer = false
else
sampAddChatMessage('[Ошибка] Введите ответ. Либо закройте репорт.', 0xDF3535)
end
elseif settings.reportstyle[k] == 1 then
inputreport.v = inputreport.v..u8(settings.reportotvet[k])
end

end
reportenter = reportenter +1
if reportenter == 3 then
reportenter=0
else
if #settings.reportname ~= k then
imgui.SameLine();
end
end
end
                                imgui.PushStyleColor(imgui.Col.Button, imgui.ImColor(1, 300, 300, 113):GetVec4())
                                if imgui.Button(u8('Отправить'),imgui.ImVec2(125,20)) then
if inputreport.v ~= '' and inputreport.v ~= nil then
sampSendDialogResponse(reportiddialog, 1, _, u8:decode(inputreport.v))
reportwindow.v = false
imgui.ShowCursor = false
    imgui.LockPlayer = false
    sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
            sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                        sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
                    sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90}'..u8:decode(inputreport.v), 0xCD5C5C)
                    sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo+1, 0xCD5C5C)
            sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
                settings.set.repkolvo = settings.set.repkolvo  + 1
else
sampAddChatMessage('[Ошибка] Введите ответ. Либо закройте репорт.', 0xDF3535)
end
                            end

                                imgui.SameLine(264);
                                if imgui.Button(u8('Закрыть'),imgui.ImVec2(125,20)) then
                        sampSendDialogResponse(reportiddialog, 2, _, _)
                        sampAddChatMessage('--------------------------------------------------------------------',0xCDAD00)
                                sampAddChatMessage('{CD5C5C}Репорт от {90EE90}'..nickreport..'['..idreport..']', 0xCD5C5C)
                                            sampAddChatMessage('{CD5C5C}Суть репорта: {90EE90}'..textreport, 0xCD5C5C)
                                        sampAddChatMessage('{CD5C5C}Ваш ответ: {90EE90}-', 0xCD5C5C)
                                        sampAddChatMessage('{CD5C5C}За сегодня ответов: {90EE90}'..settings.set.repkolvo, 0xCD5C5C)
                                sampAddChatMessage('--------------------------------------------------------------------', 0xCDAD00)
                        reportwindow.v = false
                     imgui.ShowCursor = false
                         imgui.LockPlayer = false
                            end
                                imgui.PopStyleColor()
imgui.End()


end
Для какого проекта тебе надо?