- 4
- 0
Всем привет проблема в том что не вводится текст из чата в диалоговое окно
Код:
local sampev = require('lib.samp.events')
local workState = true
local array = { 'Код (%d+)', 'Введите код: (%d+)' }
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('codes', function()
workState = not workState
printString('Work ' .. (workState and "on" or "off"), 500)
end)
while true do
wait(0)
end
end
function sampev.onServerMessage(color, text)
for k, v in pairs(array) do
lua_thread.create(function()
if text:find(v) and workState then
codeNum = text:match(v)
wait(1500) -- без задержки. 1 секунда = 1000 миллисекунд
sampSendChat('/code')
while not sampIsDialogActive() and not sampGetCurrentDialogId() == 1009 do wait(50) end
sampSendDialogResponse(1009, 1, 0, codeNum)
sampAddChatMessage("Вы ввели код: " .. codeNum, -1)
elseif text:find('/vr (%d+)') then
codeNum = text:match('/vr (%d+)')
wait(1000) -- без задержки. 1 секунда = 1000 миллисекунд
sampSendChat('/vr ' .. codeNum)
end
end)
end
end