HUB Activiy Report
 

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

HUB Activiy Report

Started by BoJlk, 02 November, 2004, 03:42:27

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BoJlk

Hello all...

I'm seeking for two script:

1st: Some litle script for reporting about  user activity
meaning the script will Collect information about
how many users were connected/disconnected from the hub, what kind activity been made by the users PM messages, Chat messages, searches...
i want to know the peak activity hours in my HUB's
and i want to know how many user's were kicked/warned/banned by what OP/VIP/Master
And i know there an option in the RC for that
[*edit]And maybe the script will Show the Activity information by percents, example "Users Activity on 10/10/04 17:00~22:00 was: 67% of peak activity"

2nd: is there a posibily for Redirect upon Disconnect
no redirecting user when disconnected from the hub
but for redirecting them when suddenly the Hub goes down...i don't think it's possible because if the ProtaX is Crashes it can't make any action to the connected user
but correct me if i'm wrong.

enema

whoa, thats one heck of a request :) I was starting to make my own script when I found this:

--Hub Stats V.01 by chill
--Serialisation by RabidWombat

statFile = "HubStats.txt"	-- The Filename
statFolder = "txt"		-- The Foldername set it to nil if not wanted
Max1 = 30			-- Time between each stats saving
cmd1 = "+hubstats"		-- Shows the Hub Stats

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------
--	MAIN SCRIPT
--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

if statFolder then
	statFile = statFolder.."/"..statFile
end

HubStats = {
	Logins = 0,
	MaxShareAmount = frmHub:GetCurrentShareAmount(),
	MaxUsers = frmHub:GetUsersCount(),
	StatsSince = date("%d/%m/%y"),
}
dofile(statFile)
--------------------------------------------------------
function Main()
	SetTimer(60*1000*Max1)
	StartTimer()
end
function OnExit()
	WriteTable(HubStats,"HubStats",statFile)
end
--------------------------------------------------------
function OnTimer()
	WriteTable(HubStats,"HubStats",statFile)
end
--------------------------------------------------------
function NewUserConnected(curUser)
	if (frmHub:GetCurrentShareAmount() > HubStats.MaxShareAmount) then
		HubStats.MaxShareAmount = frmHub:GetCurrentShareAmount()
	end
	if (frmHub:GetUsersCount() > HubStats.MaxUsers) then
		HubStats.MaxUsers = frmHub:GetUsersCount()
	end
	HubStats.Logins = HubStats.Logins + 1
end
OpConnected = NewUserConnected
--------------------------------------------------------
function DataArrival(curUser,data)
	if strsub(data,1,1) == "<" then
		data = strsub(data,strlen(curUser.sName)+4,strlen(data)-1)
		local _,_,word1 = strfind(data,"^(%S+)")
		if word1 and hubStatFunc[word1] then
			curUser:SendData(hubStatFunc[word1]())
			return 1
		end
	end
end
---------------------------------------------------------------------------------------

--	Hub Stats Functions
---------------------------------------------------------------------------------------
hubStatFunc = {
	[cmd1] = function()
		local msg = "---  Hub Stats Since "..HubStats.StatsSince.."  ---\r\n\r\n"
		msg = msg.."\tLogins: "..HubStats.Logins.."\r\n"..
		"\tPeak Users: "..HubStats.MaxUsers.."   -   Current Users: "..frmHub:GetUsersCount().."   -   Max Users Allowed: "..frmHub:GetMaxUsers().."\r\n"..
		"\tPeak Share: "..format("%.2f",(HubStats.MaxShareAmount/(1024*1024*1024*1024))).." TB"..
		"   -   Current Share: "..format("%.2f",(frmHub:GetCurrentShareAmount()/(1024*1024*1024*1024))).." TB"..
		"   -   Share/User: "..format("%.2f",(frmHub:GetCurrentShareAmount()/(1024*1024*1024)/frmHub:GetUsersCount())).." GB/User\r\n\r\n"..
		GetReggedUsers()
		return(msg)
	end,
}

function GetReggedUsers()
	local tcount,pcount = 0,0,0
	local msg = ""
	for _,profile in GetProfiles() do
		pcount = pcount + 1
		local ucount = 0
		for _,_ in GetUsersByProfile(profile) do
			ucount = ucount + 1
			tcount = tcount + 1
		end
		msg = msg.."\t    - "..profile..": "..ucount.."\r\n"
	end
	msg = "\tTotal Regged User: "..tcount.." in "..pcount.." Profiles\r\n\r\n"..msg
	return(msg)
end
---------------------------------------------------------------------------------------

--	Write Tables

---------------------------------------------------------------------------------------
function WriteTable(table,tablename,file)
	local handle = openfile(file,"w")
	Serialize(table,tablename,handle)
  	closefile(handle)
end
--------------------------------------------
function Serialize(tTable,sTableName,hFile,sTab)
	sTab = sTab or "";
	write(hFile,sTab..sTableName.." = {\n");
	for key,value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
		if(type(value) == "table") then
			Serialize(value,sKey,hFile,sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			write(hFile,sTab.."\t"..sKey.." = "..sValue);
		end
		write(hFile,",\n");
	end
	write(hFile,sTab.."}");
end

It doesnt show any PM or searching activities though

imby

You can use !stats in the hubsoft if you use 15.25, for that

BoJlk

#3
10x enema never mind the Searches thou, does the script stores the info in a *.dat file or somethign else?

And nice command !stat
it's almost perfect, i want it to be more specific...

enema

that script supposed to store all data in txt\HubStats.txt

...I have never tested it thou..

hell, yeah! !stats is great, but it doesnt give any data about peak hours in hub.

enema

s*it, forgot this one - you should create another txt file in txt folder - UserHubTime.txt

it should contain this "code":
UserHubTime = {
	["HubUpTime"] = 0,
}

Oh, and last thing - this txt folder should be inside scripts folder

BoJlk


SMF spam blocked by CleanTalk