local sampev = require 'lib.samp.events'
local state = false
function sampev.onServerMessage(mes_color, text)
if state then
local result = text:match("%[Репорт%]%s+от [^%[%]:]+%[%d+%]:")
if result ~= nil then
lua_thread.create(function()
wait(0)
sampSendChat("/ot")
end)
state = false
end
end
end
function cmd_autoreport(arg)
state = not state
sampAddChatMessage("Ловля репорта " .. (state and "включена" or "выключена"), -1)
end
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("areport", cmd_autoreport)
while true do wait(0) end
end