Total Hub Stat Script ???
 

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

Total Hub Stat Script ???

Started by AMediaMan, 03 February, 2004, 18:00:49

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AMediaMan

Hey hey all you scripters out there i am looking for a script that tells me and the users the hubs total stats.

Say if the command was !total it would show you this.

total logins = xxxxx
total bans = xxxxx
total kicks = xxxxx
highest share level = xxxxx
highest user level = xxxxx
and whatever else that might be handy :)

I would like these to be an over all total and not a daily total if possible.
I know PtokaX has a joins and leaves stat on it but it clears on every reset. :(
And i use the latest record script for peak share and peak user total but it seems to reset itself for no reason :(

Any help would be great thnx,
                     AMediaMan

PS. I am useing PtokaX td4 and if such a script is already out please point me to it :) thnx again.

Cyberia

#1
I know Robocop has such function in it.
with !hstat or with the Robocop Gui (Counters Screen).

I don't know if there are other scripts with this function in it.  :]

NightLitch

I Will have All sorts of counters in my script NXS-3 so keep your eyes open if now
my script is intressting.
//NL

c h i l l a

#3
my little version
--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

AMediaMan

#4
Very nice Chilla thnx :) any way of adding total kicks and total bans ??? if so i would be all set.

NightLitch i will also check yours out soon :)

Thnx for the quick response you guys,

                  AMediaMan

PS. thnx Cyberia but I already use a multi bot, but I have checked out Robo cop and it is a very nice script as well :o) thnx again.

c h i l l a

sure if you want to add it :).
But there are many ways of kicking banning etc. you would need to check all commands, so I left it.

AMediaMan

Well haha me adding it would be major mistake :(
it seems that every script i try to edit goes kaput heh
but anyhow i was just meaning maybe the PtokaX commands was all not every kick and ban, for that could be difficult.

Just the !kick and the !ban if its possible to add just those 2 from the actual PtokaX hub :)


thnx,
AMediaMan


PS. The other does work great :) thnx again

[NL]trucker

chill could you add a few things more?

like owner  [name]
      master    ,,
      admin      ,,
     
total  vips
total regs

hubname+hubaddy

hubuptime
 
min share
max share
min hubs
max hubs
total share in hub now
highest share
peak users

total time hub is alive and running so some kind of founding date.

could you please ???

this would be a total info script and i think it would look good :-)))
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


[NL]trucker

i have now this for hubstat

[12:09:50] ?==============???? [NL] ????? ]-[?? [NL]=================
[12:09:50]  ?
[12:09:50] ::HubOwner:[NL]trucker
[12:09:50] ::Hub Masters: TeQuilla-hollandse.ko
[12:09:50] ::Hub Address: funnyhub.no-ip.info
[12:09:50] ::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !!
[12:09:50] ::Dutch Located : Dus NLers Welkom !!
[12:09:50] ::WebSite=www.magmar.tk
[12:09:50] ::Hub-eMail:magmarnetworks@tiscali.nl
[12:09:50] ::Max Users=200
[12:09:50] ::Min Share=1GB
[12:09:50] ::Uptime = 0 days, 23 hrs. 30 min. and 3 sec. = ?
[12:09:50] ?======47 of  200 Users Connected======

guess it would be complete with the addons i requested in the above post.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


AMediaMan

#9
Hey hey [NL]trucker wouldnt that be more of a hub info script than a hub stat script >:o).
haha just a thought :)



PtokaX RULZ                L8er,AMediaMan

PS. the above script does show the number of vip's, op's
and so on :)

c h i l l a

but calculate the hubs online time is a good one I think :)
will check it out.

AMediaMan

Well you know that would ba a cool thing to have :)
 
: total time hub is alive and running so some kind of founding date:

The date included in the script is kind of a up time date but it would be great to have a total hours and mins. of actual running time :)

AMediaMan

[NL]trucker

Amediaman


QuotePS. the above script does show the number of vip's, op's

nope it doesnt it is static i edited the script to show this two [it is a messagebot]

but i have more and also i have admins

QuoteHey hey [NL]trucker wouldnt that be more of a hub info script than a hub stat script >:o).

yup your right it would be a total script stat and info together.

think it would be great to have a  all in one .
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


[NL]trucker

is there anyone who is looking into this request yet?

i think it will be a great addition in my hub.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


plop

QuoteOriginally posted by [NL]trucker
is there anyone who is looking into this request yet?

i think it will be a great addition in my hub.
i posted a script here somewhere which can show all from online/offline users/regs/vips/ops/masters.
it's a mod of the script your using now.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

AMediaMan

hey Plop you think you could do me fav. and
add maybe a total kick and maybe a total ban
for me? I just want the PtokaX commands for
kicks and bans if possible. I thank you or any1
who can make this possible >:o)



Thnx again, AMediaMan

AMediaMan

Hmmm is this a hard thing to do maybe :( well i will use what i have now thnx for the script :)




AMediaMan

plop

QuoteOriginally posted by AMediaMan
Hmmm is this a hard thing to do maybe :( well i will use what i have now thnx for the script :)
it's not that hard 2 do and you can find info/scripts here on the forum how 2 do it.
personaly i don't have the time right now, sorry for this but allready working on a big thing which is far from finished.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

AMediaMan

Ok thnx Plop :) i understand and i will look some
more :) and yes i know there are much more important things to work on :) my hub was also hacked just as the others :( so ............ i will leave the great minds alone to work on the bigger and better issues :)


AMediaMan

AMediaMan

#19
Ok I just thought of something that might be a nice add on to this script if any1 can do it :)

First the script :

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

How about adding a Peak uptime to this ? I think that would be cool >:o)

Any takers ???  Thnx ahead of time, AMediaMan

PS. Say like Max uptime = this many days, hours, and mins

[NL]trucker

Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


AMediaMan

hey hey thnx [NL]trucker i like it.

been awhile but im back >:o)


not that i can script now lol but im back to browse all that has changed.

thnx again, AMediaMan

Skyhawk

#22
Got another idea.

How about the following:

1. Show those stats at login (on/off)
2. Show those stats in main in intervals (on/off and interval)
3. Show those stats in PM in intervals (on/off and interval)

How about this?

SMF spam blocked by CleanTalk