Hublist.lua
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Hublist.lua

Started by Thor, 11 April, 2006, 15:20:21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thor

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
--|------------------------------------------
--| 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

SMF spam blocked by CleanTalk