script_name('autoreconnect')
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do
wait(1)
local chatstring = sampGetChatString(99)
if chatstring == "Сервер закрыл соединение." or chatstring == "Выбранный слот подключения был занят. Повторяем подключение..." or chatstring == "Wrong server password." then
sampDisconnectWithReason(false)
sampAddChatMessage("{9593e1}[accrstlx] {ffffff}Ожидайте, через {85b2c1}5 минут{ffffff} вы будете {15b139}подключены{ffffff} к серверу.", -1)
math.randomseed(os.clock())
wait(math.random(300000 , 1200000)) -- задержка
sampSetGamestate(1)
end
end
end