sBot = "Network-Redirector-" DefaultHub = "hawks-world.no-ip.org:411" RedirectsEnabled = "true" Hub_Adress = { "hawkie.no-ip.com", "411", "hawks-universe1.no-ip.org", "411", "technics.servemp3.com", "411", "thescotsman.no-ip.org", "411", "blazensparks.servemp3.com", "411", "hippy-chick.no-ip.com", "411", "mozzillas-music.no-ip.com", "411", } Onlinehubs = {} Onlinehubcounter = 1 HubCounter = 1 curenthub = 1 curentport = 2 mins = 1 function Main() hubcount = getn(Hub_Adress) SetTimer(1000 * 60 * mins) if RedirectsEnabled == "true" then StartTimer() end end function NewUserConnected(curUser) if (RedirectsEnabled == "false") then frmHub:SetRedirectAddress(DefaultHub) end SendToNick(curUser.sName, "<" ..sBot .."> Redirecting... |$ForceMove "..frmHub:GetRedirectAddress().."|") end function DataArrival(user, data) local data=strsub(data,1,strlen(data)-1) local s,e,cmd = strfind(data,"%b<>%s+(%S+)") if cmd=="+rdon" then SendToOps(sBot," Redirects enabled ") StartTimer() RedirectsEnabled = "true" elseif cmd=="+rdoff" then SendToOps(sBot," redirects disabled ") StopTimer() RedirectsEnabled = "false" end end function OnTimer() if curentport == hubcount + 2 then curenthub = 1 curentport = 2 end displayhub(curenthub,curentport) curenthub = curenthub + 2 curentport = curenthub + 1 frmHub:SetRedirectAddress(Onlinehubs[HubCounter]) if (getn(Onlinehubs) == 0) then frmHub:SetRedirectAddress(DefaultHub) end if HubCounter == getn(Onlinehubs) then HubCounter = 1 else HubCounter = HubCounter + 1 end CurrentOnlineHubs() end function displayhub(curenthub,curentport) local a = connect(Hub_Adress[curenthub],Hub_Adress[curentport]) CurrentChecking = Hub_Adress[curenthub]..":"..Hub_Adress[curentport] Active = "false" ActiveHubCount = getn(Onlinehubs) + 1 for index, value in Onlinehubs do if Onlinehubs[index] == CurrentChecking then Active = "true" Position = index end end if a == nil then if Active == "false" then SendToOps(sBot,CurrentChecking.." Hub is still Offline") elseif Active == "true" then SendToOps(sBot,CurrentChecking.." Hub Has Gone Offline") Onlinehubs[Position] = nil end else if Active == "false" then SendToOps(sBot,CurrentChecking.." Has Come Online") Onlinehubs[ActiveHubCount] = CurrentChecking elseif Active == "true" then SendToOps(sBot,CurrentChecking.." Hub is still online") end a:close() end end function CurrentOnlineHubs() local names = "\r\n\r\n-------------Current Online Hubs----------------\r\n\r\n\t" for index, value in Onlinehubs do local line = index names = names.." "..Onlinehubs[line].."\r\n\t" end names = names.."\r\n\r\nCurrently Redirecting to "..frmHub:GetRedirectAddress().."\r\n\r\n" SendToOps(sBot,names) end