local sampev = require('lib.samp.events')
local active = false
local cmd = ''
local waiting = 5000 -- wait time in milliseconds
local did = 123 -- your dialog id
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('/spamcmd', function (arg)
cmd = arg
active = not active
end)
while true do
wait(0)
if active then
wait(waiting)
sampProcessChatInput(cmd)
end
end
end
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
if active then
if dialogId == did then
sampSendDialogResponse(dialogId, 1, 0, '') -- вместо 1 - кнопка которую надо нажать, вместо 0 - элемент из списка(если не список то оставь 0, счёт элементов списка начинается с 0, вместо '' - текст, введенный в поле ввода, если нету, то оставь '')
end
end
end