local sampev = require("samp.events")
local isDialogSave = false
local dialogData = {}
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand("savenextdialog", function()
isDialogSave = not isDialogSave
printStringNow(isDialogSave and "~g~following dialog will be saved" or "~r~dialogs will not be saved", 2000)
end)
sampRegisterChatCommand("showsavedialog", function()
if table.getn(dialogData) > 0 then
sampShowDialog(table.unpack(dialogData))
sampSetDialogClientside(false)
dialogData = {}
end
end)
end
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
if isDialogSave then
printStringNow("~y~dialog is saved", 2000)
dialogData = { dialogId, title, text, button1, button2, style }
isDialogSave = false
return false
end
end