Взаимодействие с диалогом.

trxpboi

Участник
Автор темы
98
5
Версия MoonLoader
.026-beta
Господа, помогите с кодом. Хочу сделать автологин на сервере. Но при использовании sampSendDialogResponse ничего не происходит, и диалог так же остается (не вводится текст, а именно пароль, почта и т.п.). Есть решение?

Lua:
function samp.onShowDialog(dialogId, style, title, button1, button2, text)
    if dialogId == 10 then
        sampSendDialogResponse(10, 1, listitem, "223322") --password
        sampAddChatMessage(dialogId, color)
    end
end
 

savvin

Известный
409
142
Ща попробую, спасибо.
Много раз тестил с sampSendDialogResponse, хз, не работает никогда, мб я рукожоп
Если у тебя тоже на сработает, используй sampSetCurrentDialogEditboxText и sampCloseCurrentDialogWithButton, предварительно поставив задержку
 
  • Нравится
Реакции: trxpboi

wulfandr

Известный
637
260
Lua:
    local lsampev, sp = pcall(require, 'lib.samp.events')
    
    require 'lib.moonloader'
    parol = 'yourpassword'
    
    function main()
        repeat wait(0) until isSampAvailable()
        wait(-1)
    end   

    function sp.onShowDialog(id, style, title, button1, button2, text)
        if id == 2 then -- 2 = ИД диалога.
            sampSendDialogResponse(id, 1, _, parol)
            sampAddChatMessage("Вы успешно вошли в свой аккаунт, приятной игры!", 0x22FF00)
            return false
        end
    end
 

trxpboi

Участник
Автор темы
98
5
Lua:
    local lsampev, sp = pcall(require, 'lib.samp.events')
  
    require 'lib.moonloader'
    parol = 'yourpassword'
  
    function main()
        repeat wait(0) until isSampAvailable()
        wait(-1)
    end 

    function sp.onShowDialog(id, style, title, button1, button2, text)
        if id == 2 then -- 2 = ИД диалога.
            sampSendDialogResponse(id, 1, _, parol)
            sampAddChatMessage("Вы успешно вошли в свой аккаунт, приятной игры!", 0x22FF00)
            return false
        end
    end
чет не робит, попробую через этот метод "используй sampSetCurrentDialogEditboxText и sampCloseCurrentDialogWithButton, предварительно поставив задержку "
 

savvin

Известный
409
142
чет не робит, попробую через этот метод "используй sampSetCurrentDialogEditboxText и sampCloseCurrentDialogWithButton, предварительно поставив задержку "
Потому что сразу отправляешь пакет в никуда, еще и не показав юзеру диалог
 
  • Нравится
Реакции: trxpboi

trxpboi

Участник
Автор темы
98
5
Не могу понять как сделать thread, помогите)
Lua:
samp = require "lib.samp.events"
require 'lib.moonloader'

function main()
    repeat wait(0) until isSampAvailable()
    wait(2000)
    wait(-1)
end

function samp.onShowDialog(dialogId, style, title, button1, button2, text)
    if dialogId == 9 and sampIsDialogActive() then
        wait(3000)
       sampCloseCurrentDialogWithButton(1)
    end
end
 

savvin

Известный
409
142
Не могу понять как сделать thread, помогите)
Lua:
samp = require "lib.samp.events"
require 'lib.moonloader'

function main()
    repeat wait(0) until isSampAvailable()
    wait(2000)
    wait(-1)
end

function samp.onShowDialog(dialogId, style, title, button1, button2, text)
    if dialogId == 9 and sampIsDialogActive() then
        wait(3000)
        ampCloseCurrentDialogWithButton(1)
    end
    if dialogId == 10 and sampIsDialogActive() then
        wait(3000)
        sampAddChatMessage("22", color)
        sampSetCurrentDialogEditboxText("223322")
        ampCloseCurrentDialogWithButton(1)
    end
    if dialogId == 797 then
        sampSendDialogResponse(797, 1, _, "223322") --password second
        sampAddChatMessage(dialogId, color)
    end
    if dialogId == 11 then
        sampSendDialogResponse(11, 1, _, "diamond@gmail.com") --mail
        sampAddChatMessage(dialogId, color)
    end
    if dialogId == 15 then
        sampSendDialogResponse(15, 1, _, _) --sex
    end
    if dialogId == 16 then
        sampSendDialogResponse(16, 1, _, _) --skin
    end
    if dialogId == 17 then
        sampSendDialogResponse(17, 1, 3, _) --nati
    end
    if dialogId == 18 then
        sampSendDialogResponse(18, 1, _, "25") --age
    end
    if dialogId == 19 then
        sampSendDialogResponse(19, 1, _, _) --promocode
    end
end
Lua:
lua_thread.create(function()
    wait(мс)
    -- нужный тебе код
end)
 
  • Нравится
Реакции: trxpboi

trxpboi

Участник
Автор темы
98
5
Lua:
lua_thread.create(function()
    wait(мс)
    -- нужный тебе код
end)
говнокодер я)) не робит все равно. Завтра на свежую голову доработаю. Всем спасибо!
Пофиксил, работает. Все еще раз спасибо!
 

ШPEK

Известный
1,476
524
Lua:
    local lsampev, sp = pcall(require, 'lib.samp.events')
    
    require 'lib.moonloader'
    parol = 'yourpassword'
    
    function main()
        repeat wait(0) until isSampAvailable()
        wait(-1)
    end   

    function sp.onShowDialog(id, style, title, button1, button2, text)
        if id == 2 then -- 2 = ИД диалога.
            sampSendDialogResponse(id, 1, _, parol)
            sampAddChatMessage("Вы успешно вошли в свой аккаунт, приятной игры!", 0x22FF00)
            return false
        end
    end
Попробуй -1 вместо _