looking for user hubtime
 

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

looking for user hubtime

Started by SaintSinner, 11 November, 2003, 22:24:16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SaintSinner

hey guys im looking for a user hubtime script
or which script does it, for example
-uptime saintisnner
saintsinner has been in this hub for 29 hours.

i would like it to check the consistency of users i download large files from.
possible?
   


plop

this looks like a yes.
=====================================
  Here is the info from: [TGA-OP]plop
=====================================
  IP: 			xxx.xxx.xxx.xxx
  Client type: 		DC++
  Version: 			0.241
  Mode: 			active
  Hub(s) as regular user: 	0
  Hub(s) as registered user: 	0
  Hub(s) as operator: 		2
  Upload slot(s): 		4
  Connection type: 		DSL
  Sharing: 		69.62 GB
  Total time in hub: 		20 days 23 hours 10 mins
  This visit: 			3 mins
  Description: 		ikke
  Processing time: 		0 seconds
=====================================
 
soon 2 be released A.I. bot.
after that i'll release a stand alone version of the userinfo part.
there is also another script around wich does something like it but it saves the data every minute.
no idea who made that 1.

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

SaintSinner

wow sweet exactly what im looking for :D  :D
   


SaintSinner

#3
X( damn doublepost X(  X(
   



SaintSinner

nice chilla
can you get it to pull only one name from the file like
+uptime saintsinner

He has been online for::0 Months, 0 Days, 0 Hours, 1 Min ( 1 min ).
   


c h i l l a

sure here you go

--OnHub Time Logger V.1.63
--27.9.03 by c h i l l e r
--thx to tezlo for the nice calculation from minutes to months, days, etc., and to Nagini, and to RabidWombat
--Create a "txt" Folder in the PtokaX scripts Folder, like this /scripts/txt/

--ChangeLog :
--27.9.03 Added Serialisation.

-- Name this bot to what you want
bot="-= Hub Time =-"

--Name the commands to what you like
cmd1 = "+myhubtime"
cmd2 = "+allhubtime"
cmd3 = "+hubtime"
cmd4 = "+uptime"

--This number stands for the maximum of displayed users, set it to what U like
Max = 20
--This number is for the timespan between each data saving in minutes.
Max1 = 30
--This number stands for time in minutes, a user must be online till he is saved to the file.
Max2 = 10
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------

File1 = "UserHubTime.txt"

sec = 1000 
min = 60 * sec

var1 = 0

assert(dofile("txt/"..File1), "txt/"..File1.." for HubTime-V.163.lua not found")

function Main()
	SetTimer(1 * min) 
	StartTimer()
end 

function OnTimer()
	for i,v in UserHubTime do
		if GetItemByName(i) or i=="HubUpTime" then
			v=v+1
			UserHubTime[i]=v
		end
	end
	var1 = var1 + 1
	if var1 == Max1 then
		WriteFile(UserHubTime, "UserHubTime", File1)
		var1 = 0
	end
end

function NewUserConnected(curUser)
	if UserHubTime[curUser.sName]==nil then
		UserHubTime[curUser.sName]=0
	end
end

function OpConnected(curUser)
	if UserHubTime[curUser.sName]==nil then
		UserHubTime[curUser.sName]=0
	end
end

function DataArrival(curUser,data)
	if (strsub(data, 1, 1) == "<") then 
		data = strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind( data, "%b<>%s+(%S+)" )

		if (cmd and strlower(cmd) == strlower(cmd1) and UserHubTime[curUser.sName] ) then
			local tmp = UserHubTime[curUser.sName]
			local months, days, hours, minutes = floor(tmp/43200), floor(mod(tmp/1440, 30)), floor(mod(tmp/60, 24)), floor(mod(tmp/1, 60))
			curUser:SendData(bot, "You have been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ). That is "..format("%.2f",tmp/UserHubTime["HubUpTime"]*100).." % of the total HubUpTime.")
			return 1

		if (cmd and strlower(cmd) == strlower(cmd4)) then
			local _,_,user = strfind( data, "%b<>%s+%S+%s+(%S+)" )
			if user and UserHubTime[user] then
				local tmp = UserHubTime[user]
				local months, days, hours, minutes = floor(tmp/43200), floor(mod(tmp/1440, 30)), floor(mod(tmp/60, 24)), floor(mod(tmp/1, 60))
				curUser:SendData(bot, "User: "..user.." has been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ). That is "..format("%.2f",tmp/UserHubTime["HubUpTime"]*100).." % of the total HubUpTime.")
				return 1
			end

		elseif (cmd and strlower(cmd) == strlower(cmd2)) then
			curUser:SendData(bot, "   -= The Top "..Max.." Campers =-\r\n"..
			GetUserMaxTime().."\r\n")
			return 1

		elseif (cmd and strlower(cmd) == strlower(cmd3)) then
			local tmp = UserHubTime["HubUpTime"]
			local months, days, hours, minutes = floor(tmp/43200), floor(mod(tmp/1440, 30)), floor(mod(tmp/60, 24)), floor(mod(tmp/1, 60))
			curUser:SendData(bot, "The hub has now been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ).")
			return 1

		end
	end
end
----------------------------------------------------------------------------------------------------------
function WriteFile(table, tablename, file)
	local handle = openfile("txt/"..file, "w")
	write(handle, tablename.." = {\n" )
	for key, value in table do
		if value >= Max2 then
			write(handle, "\t"..format("[%q]",key).." = "..value..",\n")
		end
	end
	write(handle, "}");
  	closefile(handle)
end
----------------------------------------------------------------------------------------------------------
function GetUserMaxTime()
	local TCopy={}
	for i,v in UserHubTime do
		if i~="HubUpTime" then
			tinsert( TCopy, { tonumber(v),i } )
		end
	end
	sort( TCopy, function(a, b) return (a[1] > b[1]) end)
	local msg ="\r\n"
	for i = 1,Max do
		if TCopy[i] then
			local months, days, hours, minutes = floor(TCopy[i][1]/43200), floor(mod(TCopy[i][1]/1440, 30)), floor(mod(TCopy[i][1]/60, 24)), floor(mod(TCopy[i][1]/1, 60))
			msg = msg.."\t\t# "..i.."  -  "..TCopy[i][2].."\t::\t"..months.." Months, "..days.." Days, "..hours.." Hours, "..minutes.." Min ( "..TCopy[i][1].." min ).\r\n"
		end
	end
	local TCopy={}
	return msg
end
----------------------------------------------------------------------------------------------------------

SaintSinner

WOOHOO thanx
 :D  :D  :D  :D  :D
   


SaintSinner

ok im getting this
Syntax Error: `end' expected (to close `if' at line 72);
  last token read: `if' 
at line 78 in string "--OnHub Time Logger V.1.63


it has to do with this line
if (cmd and strlower(cmd) == strlower(cmd1) and UserHubTime[curUser.sName] ) then

under the function DataArrival(curUser,data)

 :(
   


c h i l l a

stupid mistake grrrr.

new code

--OnHub Time Logger V.1.63
--27.9.03 by c h i l l e r
--thx to tezlo for the nice calculation from minutes to months, days, etc., and to Nagini, and to RabidWombat
--Create a "txt" Folder in the PtokaX scripts Folder, like this /scripts/txt/

--ChangeLog :
--27.9.03 Added Serialisation.

-- Name this bot to what you want
bot="-= Hub Time =-"

--Name the commands to what you like
cmd1 = "+myhubtime"
cmd2 = "+allhubtime"
cmd3 = "+hubtime"
cmd4 = "+uptime"

--This number stands for the maximum of displayed users, set it to what U like
Max = 20
--This number is for the timespan between each data saving in minutes.
Max1 = 30
--This number stands for time in minutes, a user must be online till he is saved to the file.
Max2 = 10
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------

File1 = "UserHubTime.txt"

sec = 1000 
min = 60 * sec

var1 = 0

assert(dofile("txt/"..File1), "txt/"..File1.." for HubTime-V.163.lua not found")

function Main()
	SetTimer(1 * min) 
	StartTimer()
end 

function OnTimer()
	for i,v in UserHubTime do
		if GetItemByName(i) or i=="HubUpTime" then
			v=v+1
			UserHubTime[i]=v
		end
	end
	var1 = var1 + 1
	if var1 == Max1 then
		WriteFile(UserHubTime, "UserHubTime", File1)
		var1 = 0
	end
end

function NewUserConnected(curUser)
	if UserHubTime[curUser.sName]==nil then
		UserHubTime[curUser.sName]=0
	end
end

function OpConnected(curUser)
	if UserHubTime[curUser.sName]==nil then
		UserHubTime[curUser.sName]=0
	end
end

function DataArrival(curUser,data)
	if (strsub(data, 1, 1) == "<") then 
		data = strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind( data, "%b<>%s+(%S+)" )

		if (cmd and strlower(cmd) == strlower(cmd1) and UserHubTime[curUser.sName] ) then
			local tmp = UserHubTime[curUser.sName]
			local months, days, hours, minutes = floor(tmp/43200), floor(mod(tmp/1440, 30)), floor(mod(tmp/60, 24)), floor(mod(tmp/1, 60))
			curUser:SendData(bot, "You have been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ). That is "..format("%.2f",tmp/UserHubTime["HubUpTime"]*100).." % of the total HubUpTime.")
			return 1

		elseif (cmd and strlower(cmd) == strlower(cmd4)) then
			local _,_,user = strfind( data, "%b<>%s+%S+%s+(%S+)" )
			if user and UserHubTime[user] then
				local tmp = UserHubTime[user]
				local months, days, hours, minutes = floor(tmp/43200), floor(mod(tmp/1440, 30)), floor(mod(tmp/60, 24)), floor(mod(tmp/1, 60))
				curUser:SendData(bot, "User: "..user.." has been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ). That is "..format("%.2f",tmp/UserHubTime["HubUpTime"]*100).." % of the total HubUpTime.")
				return 1
			end

		elseif (cmd and strlower(cmd) == strlower(cmd2)) then
			curUser:SendData(bot, "   -= The Top "..Max.." Campers =-\r\n"..
			GetUserMaxTime().."\r\n")
			return 1

		elseif (cmd and strlower(cmd) == strlower(cmd3)) then
			local tmp = UserHubTime["HubUpTime"]
			local months, days, hours, minutes = floor(tmp/43200), floor(mod(tmp/1440, 30)), floor(mod(tmp/60, 24)), floor(mod(tmp/1, 60))
			curUser:SendData(bot, "The hub has now been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ).")
			return 1

		end
	end
end
----------------------------------------------------------------------------------------------------------
function WriteFile(table, tablename, file)
	local handle = openfile("txt/"..file, "w")
	write(handle, tablename.." = {\n" )
	for key, value in table do
		if value >= Max2 then
			write(handle, "\t"..format("[%q]",key).." = "..value..",\n")
		end
	end
	write(handle, "}");
  	closefile(handle)
end
----------------------------------------------------------------------------------------------------------
function GetUserMaxTime()
	local TCopy={}
	for i,v in UserHubTime do
		if i~="HubUpTime" then
			tinsert( TCopy, { tonumber(v),i } )
		end
	end
	sort( TCopy, function(a, b) return (a[1] > b[1]) end)
	local msg ="\r\n"
	for i = 1,Max do
		if TCopy[i] then
			local months, days, hours, minutes = floor(TCopy[i][1]/43200), floor(mod(TCopy[i][1]/1440, 30)), floor(mod(TCopy[i][1]/60, 24)), floor(mod(TCopy[i][1]/1, 60))
			msg = msg.."\t\t# "..i.."  -  "..TCopy[i][2].."\t::\t"..months.." Months, "..days.." Days, "..hours.." Hours, "..minutes.." Min ( "..TCopy[i][1].." min ).\r\n"
		end
	end
	local TCopy={}
	return msg
end
----------------------------------------------------------------------------------------------------------

SaintSinner

#10
@chilla i think i fixed it
here is what i did
im not a scripter so tell me if i did something wrong :D
i end the
function DataArrival(curUser,data)
	
if (
strsub(data11) == "<"then 
	
	
data strsub(data,1,strlen(data)-1)
	
	
local _,_,cmd strfinddata"%b<>%s+(%S+)" )
	
	

	
	
if (
cmd and strlower(cmd) == strlower(cmd1) and UserHubTime[curUser.sName] ) then
	
	
	
local tmp UserHubTime[curUser.sName]
	
	
	
local monthsdayshoursminutes floor(tmp/43200), floor(mod(tmp/144030)), floor(mod(tmp/6024)), floor(mod(tmp/160))
	
	
	
curUser:SendData(bot"You have been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ). That is "..format("%.2f",tmp/UserHubTime["HubUpTime"]*100).." % of the total HubUpTime.")
	
	
	
return 
1
	
end



i gave it a end  and i got no errors
what do you think? :]
   


SaintSinner

oops i was  too slow

thanks
   


c h i l l a

#12
you are calling a if function  in a if function

so I think it won't work...   but hey check out  write your own bot,  in the how too's section...  you will learn a lot, at least how to not do such damn mistakes ;).

hey I was faster ;),  usually I'm the slow one.

SaintSinner

QuoteOriginally posted by c h i l l a
you are calling a if function  in a if function

so I think it won't work...   but hey check out  write your own bot,  in the how too's section...  you will learn a lot, at least how to not do such damn mistakes ;).

hey I was faster ;),  usually I'm the slow one.


yups im on my way there

thanks again
   


plop

cool 1 chilla, i gotta add that HubUpTime 2 my script.
nice 2 see a 3de way of calculating the time.
i'm using the julian day function from tezlo.
this way i can save when a user leaves the hub, every xx users it saves 2 file.

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

SMF spam blocked by CleanTalk