samp = require 'samp.events'
dialogs = {}
function main() wait(-1) end
function samp.onSendDialogResponse(id, button, list, input) dialogs[id] = { list, input } end
function samp.onShowDialog(id, style, title, b1, b2, text)
if dialogs[id] then
lua_thread.create(function()
repeat wait(0) until sampIsDialogActive() and sampGetCurrentDialogId() == id
sampSetCurrentDialogListItem(dialogs[id][1])
sampSetCurrentDialogEditboxText(dialogs[id][2])
end)
end
end