Author Topic: Server Checker  (Read 766 times)

Ace

  • Administrators
  • Full Member
  • ***
  • Posts: 227
    • View Profile
    • http://
Server Checker
« on: February 13, 2009, 05:56:14 PM »
This script checks the BNLS servers that are online every 30 minutes, and checks if the BNLS you use is currently down, if you use one.
You can change these numbers at the top of the script.

Code: [Select]
'servers
'1.0
'7thAce

Const servers_AutoDisplayTimer = 30 '// Time in minutes to check all servers.  Displays them with addchats.
Const servers_CheckBNLSTimer = 5 '// Time in minutes to check your server.  Only displays an error if your server is down and you use BNLS.
Const servers_AutoChange = True '// True or False - Changes your BNLS if the current one is down and you do not use Hashes.

Sub servers_event_load()
Addchat vbMagenta, "Server checker loaded.  Type ""/server update"" to check the server statuses."
Atime = 60 * servers_AutoDisplayTimer
TimerInterval "servers", "Autodisplay", Atime
TimerEnabled "servers", "Autodisplay", True
Btime = 60 * servers_CheckBNLSTimer
TimerInterval "servers", "CheckBNLS", Btime
TimerEnabled "servers", "CheckBNLS", True
End Sub

Sub servers_event_pressedenter(text)
 If left(lcase(text), 8) = "/server " Then
 Vetothismessage()
  If lcase(text) = "/server update" Then
  Content = scInet.OpenURL("http://python.bot.nu/py/status.php")
  Args = Split(Content, "<img src='img/text_")
  Serverlist = Split(Content, "<a href='status.php?server=")
   For i = 0 to Ubound(Serverlist)
   Serverlist(i) = Left(Serverlist(i), Instr(Serverlist(i), ":") - 1)
   Next
   For i = 0 to Ubound(Args)
   If left(Args(i), 1) = "d" Then Addchat vbred, "Server " & Serverlist(i) & " is currently offline."
   If left(Args(i), 1) = "c" Then Addchat vbgreen, "Server " & Serverlist(i) & " is currently online."
   Next
  End If
 End If
End Sub

Sub servers_Autodisplay_timer()
Text = "/server update"
Call servers_event_pressedenter(text)
End Sub

Sub servers_CheckBNLS_timer()
BNLS = GetConfigEntry("Main", "SetBNLSServer", "Config.ini")
Content = scInet.OpenURL("http://python.bot.nu/py/status.php")
Serverlist = Split(Content, "<a href='status.php?server=")
For i = 0 to Ubound(Serverlist)
Serverlist(i) = Left(Serverlist(i), Instr(Serverlist(i), ":") - 1)
Next
For i = 0 to Ubound(Serverlist)
If BNLS = Serverlist(i) Then
Args = Split(Content, "<img src='img/text_")
 If Left(Args(i), 1) = "d" Then
 Addchat vbred, "Warning: Your current BNLS server is offline or is not on the trusted servers list.  Please change it or use the auto-change feature."
  If servers_autochange Then
   If GetConfigEntry("Main", "UseBNLS", "Config.ini") = "Y" Then
   Addchat vbyellow, "Your BNLS Server is offline - Using auto-change to use a new server."
    If BNLS <> "pyro.no-ip.biz" Then
    WriteConfigEntry "Main", "SetBNLSServer", "pyro.no-ip.biz", "Config.ini"
    Else
    WriteConfigEntry "Main", "SetBNLSServer", "alendar.no-ip.org", "Config.ini"
    End If
   Call ReloadSettings(1)
   If SSC.IsOnline() = False Then
    Call Command(BotVars.Username, "/cq", True)
    Call SSC.Connect()
   End If
  End If
 End If
End If
End If
Next
End Sub

Please reply with comments or errors.
[img]http://zeus.cooltext.com/images/9ff/9fff41541771f1d8f564cabff80fd40cfb587413.jpg\" border=\"0\" class=\"linked-image\" /][img]http://209.85.12.232/13848/49/pip/admin.png\" border=\"0\" class=\"linked-image\" /]

Vector

  • Administrator
  • Hero Member
  • *****
  • Posts: 550
    • View Profile
    • http://clanmage.phost.ws
Server Checker
« Reply #1 on: February 13, 2009, 10:53:55 PM »
I have a better updated one on my europe bot. I took yours, and added another command so that you could replace your bnls with one that worked.

Yours will not only update the bnls once, but it will do it until it goes through the list.

You need an Exit Sub after it replaces it with the first bnls that has an online status.
I am an Unofficial StealthBot Technician, an Unofficial StealthBot scripter, among other things. See my about page for more info.

Quote from: ArticWolve
Sorry I went down. Had internet problems with a cracker-jack-licensed driver hitting my internet pole (about 8 of them fell) and drooping my phone and electricity. Sorry ><

Rev77.net Plugins Manager

Proud host of Vector.no-ip.info | VectorJBLS.no-ip.org Status: [img]http://rev77.net/ServerCheck/check.asp?query=check&server=VectorJBLS.no-ip.org_status.png\" border=\"0\" class=\"linked-image\" /]

Shito-Ryu Karate-Do Genbu-Kai Rank: 8th Kyu (White belt, one stripe)

Rev77.Net Remote Support (Double-Click my name only if you were told to)

If the above link doesn't work, or if you use Vista, try this alternate link.

Noob ~Vector