This script checking the status of all hublist regserver given in the hubsoftware. This will be very slow, if too many not-working hublist regservers are, i tested it with 13 working, 5 broken, and the test take me 2 minutes. When I removed the bad ones, the 13 working check takes just 6 seconds ;) The command is !hublist and the script requires PxWSA.dll (http://www.thewildplace.dk/downloads/wsa010_Debug_Build.zip)
--|------------------------------------------
--| Hublist regserver tester
--|
--| Written by Szmeby and Hungarista
--|
--| Any idea from Bluebear
--|
--| 2oo6. 04. 11.
--|
--| Version 1.0
--|
--|------------------------------------------
libinit = loadlib("pxwsa.dll", "_libinit")
libinit()
function ChatArrival(curUser,data)
data = string.sub(data,1,string.len(data)-1)
if curUser.bOperator then
local s,e,cmd = string.find(data,"%b<>%s(%S+)")
if cmd == "!hublist" then
reglist = frmHub:GetRegServer()
reglist = string.gsub(reglist, ";", " ")
cimek = {}
for word in string.gfind(reglist, "%S+") do
table.insert(cimek, word)
end
local vegeredmeny = ""
for i,v in cimek do
local _,_,cim, port = string.find(v, "(.+):?(%d*)")
if port == nil or port == "" then port = 2501 end
errorCode, errorStr, sock = WSA.NewSocket(0)
if errorCode then
SendPmToOps(frmHub:GetOpChatName(),"Error in the hublist.lua: Can't open socket. Maybe the pxwsa.dll file missing."..errorStr.."")
end
errorCode, errorStr = WSA.Connect(sock, cim, port)
if errorCode then
stat = "Failed... ("..errorCode.." - "..errorStr..")"
else
stat = "Succes..."
end
WSA.Close(sock)
vegeredmeny = vegeredmeny..v.." -> "..stat.."\r\n"
end
curUser:SendData(frmHub:GetHubBotName(),"\r\n"..vegeredmeny)
return 1
end
end
end