local events = require("samp.events");
local num = {};
local maxNum = 1;
function events.onShowDialog(id, style, title, button1, button2, text)
if title:find("!НУЖНЫЙ ДИАЛОГ") then
local help = 1;
local pos = 1;
while help do
help = text:match("%d+", pos);
if help then
num[#num + 1] = {};
num[#num].var = tonumber(help);
local fi, nd = text:find(help, pos);
num[#num].pos = fi;
pos = fi + help:len();
end
end
for i = 1, #num - 1 do
if num[i].var < num[i + 1].var and num[maxNum].var < num[i + 1].var then
maxNum = i + 1;
end
end
pos = 1;
local pick = 0;
while true do
local fi, nd = text:find("\n", pos);
if fi and fi < num[maxNum].pos then
pick = pick + 1;
pos = fi + 2;
else
break;
end
end
sendDialogResponse(id, 1, pick, "");
return false;
end
end