disconnected = false
require 'moonloader'
rec_sec = 60
function main()
while not isSampAvailable() do wait(0) end wait(1)
while true do wait(0)
if not sampIsLocalPlayerSpawned() then
if isKeyJustPressed(VK_D) and isKeyCheckAvailable() then sampDisconnectWithReason(quit) end
if isKeyJustPressed(VK_C) and isKeyCheckAvailable() then sampConnectToServer(select(1,sampGetCurrentServerAddress()), select(2,sampGetCurrentServerAddress())) end
end
if isKeyDown(VK_LMENU) and isKeyDown(VK_LSHIFT)
then
if isKeyJustPressed(VK_R) then
sampDisconnectWithReason(0)
sampDisconnectWithReason(0)
for i = 1,15 do
printStringNow('~w~reconnect > ~y~ '..i..'~w~!',850)
wait(1050)
if i == 15 then sampSetGamestate(1) sampDisconnectWithReason(0) end
end
end
-- if isKeyJustPressed(VK_D) then sampDisconnectWithReason(quit) end
-- if isKeyJustPressed(VK_C) then sampConnectToServer(select(1,sampGetCurrentServerAddress()), select(2,sampGetCurrentServerAddress())) end
end
if disconnected then
if sampIsLocalPlayerSpawned() then
disconnected = false
end
if isKeyJustPressed(VK_F) then
disconnected = false
printStringNow('~w~ auto-reconnect ~r~OFF~w~!',5000)
print('{FFFFFF}auto-reconnect {FF0000}OFF{FFFFFF}!')
end
end
end
end
function onReceivePacket(id, bs)
lua_thread.create(function()
if id == 32 or id == 33 or id == 36 or id == 37 and disconnected == false --[[шоб не флудило~]]
then
disconnected = true
-- sampDisconnectWithReason(quit)
for i = 1,rec_sec+1 do
-- if disconnected then
if i == rec_sec and disconnected then sampConnectToServer(select(1,sampGetCurrentServerAddress()), select(2,sampGetCurrentServerAddress())) end
addOneOffSound(0.0, 0.0, 0.0, 1085)
printStringNow('~w~recconect!wait - ~y~'..i..'~w~.. to~g~' ..rec_sec..'.',900)
print('recconect!wait - '..i..'.. to' ..rec_sec..'.')
wait(1000)
-- end
end
end
end)
end
function onSendRpc(id, bitStream, priority, reliability, orderingChannel, shiftTs)
if id == 25 and disconnected then -- RPC_CLIENTJOIN
disconnected = false
end
end
function isKeyCheckAvailable()
if not isSampLoaded() then
return true
end
if not isSampfuncsLoaded() then
return not sampIsChatInputActive() and not sampIsDialogActive()
end
return not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive()
end