диалоги

coulside

Известный
Автор темы
51
2
Версия MoonLoader
Другое
Можно как то запретить скипать диалоги на enter при появлении нужных? (часто бывает такое что вылетает диалог, и скипаешь его автоматом enter/пробелом)
Lua:
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if ini.settings.script_active then
        if dialogId == 3420 and title:find("Опубликовать объявление%?") then

            var_0_7 = { text_ad = "", text_redact = "" }

            ad_text = text:match(".*{%w*}Телефон:{%w*}%s%d*%-%d+\n\n{%w*}Текст:{%w*}%s(.*){%w*}\n")
            
          --sampAddChatMessage("{ff0000}[ADMOD]:{FFFFFF} Поймал: " .. ad_text, 11119017)

            for iter_10_0, iter_10_1 in ipairs(db) do
                if ad_text == iter_10_1.text_ad then
                    if iter_10_1.skip then
                        if iter_10_1.text_redact == "" then
                            var_0_4.skip = true
                            sampSendDialogResponse(dialogId, 1, 65535, "")
                            return false
                        else
                            var_0_4.skip = true
                            var_0_6 = iter_10_1.text_redact
                            sampSendDialogResponse(dialogId, 0, 65535, "")
        
                            return false
                        end
                    else
                        var_0_4.decline = true
                        sampSendDialogResponse(dialogId, 0, 65535, "")
      
                        return false
                    end
                end
            end

            if ini.settings.ignor_neobrabotanih then
                sampSendDialogResponse(dialogId, 0, 65535, "")
                var_0_4.propusk = true
                return false
            end

            var_0_5.action_select = true
            var_0_7.text_ad = ad_text

        elseif dialogId == 45 and text:find("В очереди на модерацию нет ни одного свободного объявления%.") then
            sampAddChatMessage("В очереди на модерацию нет ни одного свободного объявления.", 11119017)
            sampSendDialogResponse(dialogId, 1, 65535, "")
            return false
        end

        if var_0_4.propusk and dialogId == 3422 and title:find("Выберите действие") then
            var_0_4.propusk = false
            sampSendDialogResponse(dialogId, 1, 2, "")
            return false
        end

        if var_0_4.decline then
            if dialogId == 3422 and title:find("Выберите действие") then
                sampSendDialogResponse(dialogId, 1, 0, "")
                return false
            end

            if dialogId == 3421 and text:find("Объявление было успешно отклонено%.") then
                sampSendDialogResponse(dialogId, 1, 65535, "")
                var_0_4.decline = false
                sampAddChatMessage("{ff0000}[ADMOD]:{FFFFFF} Объявление: " .. ad_text, 11119017)
                lua_thread.create(function()
                    sampSendChat("/r! [A-ADMOD]: Авто отклон обьявы: " .. ad_text)
                end)
                return false
            end
        end

        if var_0_4.skip then
            if dialogId == 3422 and title:find("Выберите действие") then
                sampSendDialogResponse(dialogId, 1, 1, "")
                return false
            end

            if dialogId == 3421 and text:find("Объявление успешно отправлено в очередь на публикацию%.") then
                sampSendDialogResponse(dialogId, 1, 65535, "")
                money_adder()
                var_0_4.skip = false
                return false
            end

            if dialogId == 3421 and text:find("Объявление успешно отредактировано и отправлено в очередь на публикацию%.") then
                sampSendDialogResponse(dialogId, 1, 65535, "")
                money_adder()
                var_0_4.skip = false
                return false
            end

            if dialogId == 3423 and text:find("Введите отредактированный текст объявления") and var_0_6 ~= "" then
                sampSendDialogResponse(dialogId, 1, 65535, var_0_6)
                var_0_6 = ""
                return false
            end

            if dialogId == 3425 and title:find("Подтверждение редактирования") then
                sampSendDialogResponse(dialogId, 1, 65535, "")
                return false
            end
        end

        if dialogId == 3423 then
            ad_text = text:match(".*\n{ffffff}Текст:{abcdef} (.*){ffffff}\n.*")
            lua_thread.create(function()
                repeat wait(25) until sampIsDialogActive()
                sampSetCurrentDialogEditboxText(ad_text)
            end)
        end
    end
end

function sampev.onSendDialogResponse(arg_13_0, arg_13_1, arg_13_2, arg_13_3)
        if arg_13_0 == 3420 and arg_13_1 == 1 and isKeyDown(0x0D) then
        return false
    end

    if ini.settings.script_active then

        if var_0_5.action_select then
            if arg_13_0 == 3422 then
                if arg_13_1 == 1 then
                    if arg_13_2 == 0 then
                        var_0_7.skip = false
                        var_0_7.text_redact = ""

                        table.insert(db, var_0_7)
                        saveJson()

                        var_0_4.decline = true
                        var_0_5.action_select = false
                    elseif arg_13_2 == 1 then
                        var_0_5.redaction = true
                    elseif arg_13_2 == 2 then
                        var_0_5.action_select = false
                    end
                end
            elseif arg_13_0 == 3420 and arg_13_1 == 1 then
                var_0_7.skip = true
                var_0_7.text_redact = ""
                var_0_4.skip = true

                table.insert(db, var_0_7)
                saveJson()

                var_0_5.action_select = false
            end
        end

        if arg_13_0 == 3423 and var_0_5.redaction and arg_13_1 == 1 and string.len(arg_13_3) <= 104 then
            var_0_4.skip = true
            var_0_5.redaction = false
            var_0_7.skip = true
            var_0_7.text_redact = arg_13_3

            table.insert(db, var_0_7)
            saveJson()
        end
    end
end
 

Kermi

Активный
198
40
На вот попробовал реализовать в отдельном скрипте, вроде получилось.
noskip:
require 'lib.moonloader'

local active = true

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

    sampRegisterChatCommand("noskip", function()
        active = not active
        if active then
            sampAddChatMessage("{FFFFFF}Вкл.", -1)
        else
            sampAddChatMessage("{FFFFFF}Выкл.", -1)
        end
    end)
    
    wait(-1)
end

function onWindowMessage(msg, wparam, lparam)
    if active and sampIsDialogActive() then
        if msg == 256 or msg == 257 or msg == 258 then
            if wparam == 13 or wparam == 32 then
                consumeWindowMessage(true, true)
            end
        end
    end
end
 
  • Нравится
Реакции: coulside