--============================================================ --========= Network hub pinger redirect Manager ============== --============= By ¨˜”°º•Hawk•º°”˜¨ 25-05-04 ================= --============================================================ --=====This Script is designed to be run on its own hub ====== --======= Use another Ptokax hub on a different port ========= --============================================================ --========== +rdon = enable / +rdoff = disable =============== --================== Editable settings ======================= sBot = "Network-Redirector-" --// Bot name DefaultHub = "DefaultHub.no-ip.org:411" --// Default redirect hub Addy:Port RedirectsEnabled = "true" --// true/false Auto start mins = 1 --// Ping Next Hub after # mins Hub_Adress = { "Hub1.no-ip.com", "411", "Hub2.no-ip.org", --// Hubs In network "415", --// you can add / remove as many as you want "Hub3.servemp3.com", --// but keep the same layout "412", --// hub then port "Hub4.no-ip.org", "417", "Hub5.servemp3.com", "411", "Hub6.no-ip.com", "414", "Hub7.no-ip.com", "412", } --========= Mess With The Below at your own Peril =========== Onlinehubs = {} HubCounter = 1 curenthub = 1 curentport = 2 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 --============================================================ --===================! ! ! PING ! ! ! ======================= 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 --============================================================ --===================! ! ! PONG ! ! ! ======================= function CurrentOnlineHubs() local names = "\r\n\r\n-------------Curent 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\nCurently Redirecting to "..frmHub:GetRedirectAddress().."\r\n\r\n" SendToOps(sBot,names) end --===================== End Of Script ========================