D
deleted-user-163337
Гость
Автор темы
- Версия MoonLoader
- Другое
Добрый день, уважаемые. Не работает код:
Вместо того, чтобы через время, вычисленное через math.random вставить ответ на клад и закрыть диалог, он просто закрывает диалог через время. Ответы есть в скрипте, все хорошо по этой части. Помогите, вдруг тут что-то по части кода не так.
Lua:
function samp.onShowDialog(id, style, title, btn1, btn2, text)
questions = read_answers()
if id == 13101 then
Answered = false
WaitingAnswer = false
if text:find('Максимальный срок деморгана в секундах') then
CurQuest = 'Максимальный срок деморгана в секундах'
else
if CurQuest:find('?') then
CurQuest = text:match('Вопрос:%s+(.*)?')
else
CurQuest = text:match('Вопрос:%s+(.*)%s+Введите')
end
end
if CurQuest then
sampAddChatMessage(tag..' Вопрос: '..CurQuest, -1)
CurQuest = CurQuest:gsub('%%', '')
CurQuest = CurQuest:gsub(' ', '')
CurQuest = CurQuest:gsub(',', '')
CurQuest = CurQuest:gsub('-', '')
CurQuest = CurQuest:gsub(' ', '')
for i = 1, #questions do
textik = questions[i]
if textik ~= nil then
question, answer = textik:match("{q = '(.*)', a = '(.*)'}")
if question ~= nil then
question = question:gsub('%%', '')
question = question:gsub(' ', '')
question = question:gsub(',', '')
question = question:gsub('-', '')
question = question:gsub(' ', '')
if CurQuest:find(question) then
lua_thread.create(function()
sampAddChatMessage(answer, -1)
math.randomseed(os.time())
wait(math.random(3643,9147))
sampSendDialogResponse(id, 1, 0, answer)
Answered = true
WaitingAnswer = false
sampCloseCurrentDialogWithButton(0)
return false
end)
end
end
end
end
end
if not Answered then
sampAddChatMessage(tag..' Ответ не найден, введите ответ и он будет сохранен', -1)
WaitingAnswer = true
end
end
if id == 13100 then
sampSendDialogResponse(id, 1, 0, '')
return false
end
end