Скип диалоговых окон АРЗ

oZzY-4

Известный
Автор темы
38
7
После вход часто появляются окна по типу привязки почты и тп, так же после смерти есть диалог окна, ищу скрипт который будет скипать любое окно диалого через 10 секунд после его появления
 

Vetrayo

Известный
44
11
потести

Lua:
local ev = require 'lib.samp.events'
local lastDialogText = ""
local dialogOpenTime = nil

function onDialogResponse(dialogId, button, listitem, inputtext)
    resetText()
end

function ev.onShowDialog(id, style, title, button1, button2, text)
    dialogOpenTime = os.time()
end

function resetText()
    lastDialogText = sampGetDialogText()
end

function main()
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        local dialogId, dialogText = sampGetCurrentDialogId(), sampGetDialogText()
        if dialogId ~= nil and dialogText ~= nil then
            if dialogText ~= lastDialogText then
                resetText()
            elseif dialogOpenTime ~= nil then
                if os.difftime(os.time(), dialogOpenTime) >= 10 then
                    sampCloseCurrentDialogWithButton(0)
                    dialogOpenTime = nil
                    dialogText = nil
                end
            end
        else
            dialogOpenTime = nil
            lastDialogText = ""
        end
    end
end
 
  • Нравится
  • Bug
Реакции: oZzY-4 и Landyshev

oZzY-4

Известный
Автор темы
38
7
потести

Lua:
local ev = require 'lib.samp.events'
local lastDialogText = ""
local dialogOpenTime = nil

function onDialogResponse(dialogId, button, listitem, inputtext)
    resetText()
end

function ev.onShowDialog(id, style, title, button1, button2, text)
    dialogOpenTime = os.time()
end

function resetText()
    lastDialogText = sampGetDialogText()
end

function main()
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        local dialogId, dialogText = sampGetCurrentDialogId(), sampGetDialogText()
        if dialogId ~= nil and dialogText ~= nil then
            if dialogText ~= lastDialogText then
                resetText()
            elseif dialogOpenTime ~= nil then
                if os.difftime(os.time(), dialogOpenTime) >= 10 then
                    sampCloseCurrentDialogWithButton(0)
                    dialogOpenTime = nil
                    dialogText = nil
                end
            end
        else
            dialogOpenTime = nil
            lastDialogText = ""
        end
    end
end
Благодарен, проверю
 

Tema05

Известный
1,442
402
потести

Lua:
local ev = require 'lib.samp.events'
local lastDialogText = ""
local dialogOpenTime = nil

function onDialogResponse(dialogId, button, listitem, inputtext)
    resetText()
end

function ev.onShowDialog(id, style, title, button1, button2, text)
    dialogOpenTime = os.time()
end

function resetText()
    lastDialogText = sampGetDialogText()
end

function main()
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        local dialogId, dialogText = sampGetCurrentDialogId(), sampGetDialogText()
        if dialogId ~= nil and dialogText ~= nil then
            if dialogText ~= lastDialogText then
                resetText()
            elseif dialogOpenTime ~= nil then
                if os.difftime(os.time(), dialogOpenTime) >= 10 then
                    sampCloseCurrentDialogWithButton(0)
                    dialogOpenTime = nil
                    dialogText = nil
                end
            end
        else
            dialogOpenTime = nil
            lastDialogText = ""
        end
    end
end
Когда тебе платят за колличество написанного кода