PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: NemeziS on 28 December, 2004, 01:46:39

Title: Hub statistic.
Post by: NemeziS on 28 December, 2004, 01:46:39
Hello, guys!

I'm doing my own hubstat script now. So I have a little problem with counting online/offline/registered users.
The problem root is: I have a lot of different profiles.
I need only info about:

1) Operators onine
2) Vips online
3) Regs online
4) Unreg users online
5) Total users online
6) Operators offline
7) Vips offline
8) Regs offline
9) How many Ops registered
10) How many Vips registered
11) How many users registered

Can someone help me?  :))

Best regards,
NemeziS
Title:
Post by: NemeziS on 28 December, 2004, 16:29:28
Thanx, Mutor!

Great function!

But I also need counting unregged (who not belong to any profile and not simply regged) users on my hub.

And the word "REG" is sometimes not correct, because users that belong to different profile are regged too!

I thought it can count all "regged" users.
Have you any idea about this?  :)

Best regards,
NemeziS
Title:
Post by: [_XStaTiC_] on 28 December, 2004, 22:44:11
Ok I don't know if this is right, but it works good for me. It counts the unregged users

--AdTimer 1.1
--
--by Mutor
--Optimized by Optimus, thx
--
--Yet another Hub Advert script
--Sends hub Advert on timer or by command
--
--
--User Settings-------------------------------------------------------------------------------------
bot = "HubAd" -- Name for bot
mins = 180 -- Interval [in minutes] between Ads
Hubaddy = "yourhub.no-ip.com" -- Duh?
HubOwner = "Mutor" -- Duh?
Prefix = "+" -- Set Command Prefix
AdComm = "ad" -- Command to send Ad immediately
TZone = " -5 GMT [EST]" -- Time Zone hub resides in
HubMsg1 = "" -- Additional notices/info to be sent with ad
HubMsg2 = "" -- Additional notices/info to be sent with ad
HubMsg3 = "" -- Additional notices/info to be sent with ad
unregs = frmHub:GetUsersCount()                         -- count unregged users
--End User Settings----------------------------------------------------------------------------------

function Main()
SetTimer(mins*60000)
StartTimer()
end

function DataArrival(user, data)
s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
if (cmd==Prefix..AdComm) and user.bOperator then
OnTimer()  
end
end

function OnTimer()
local tmp
tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
tmp = tmp.."\t[ "..frmHub:GetHubName().." ]\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n"
tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n"
tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n"
tmp = tmp.."\tHub Time: \t( "..date("%B %d %Y %X ").." ) - "..TZone .."\r\n"
tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\tRedirect To: \t"..frmHub:GetRedirectAddress().."\r\n"
tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
tmp = tmp.."\tRedirect All: \t"..RedirAll().."\r\n"
tmp = tmp.."\tRedirect Full: \t"..RedirFull().."\r\n"
tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n"
tmp = tmp.."\tMin Share: \t"..format("%.2f GB",frmHub:GetMinShare()/1024).."\r\n"
tmp = tmp.."\tHub Share: \t"..format("%.2f GB",frmHub:GetCurrentShareAmount()/(1024 * 1024 * 1024)).."\r\n"
tmp = tmp.."\tMasters Online: \t"..cProfile("Master").."\r\n"
tmp = tmp.."\tOps Online: \t"..cProfile("Operator").."\r\n"
tmp = tmp.."\tVips Online: \t"..cProfile("VIP").."\r\n"
tmp = tmp.."\tRegs Online: \t"..cProfile("REG").."\r\n"
tmp = tmp.."\tUnregs Online: \t"..unregs.."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tTotal Online:\t\t"..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tNotice(s):\r\n"
tmp = tmp.."\t-- "..HubMsg1.."\r\n"
tmp = tmp.."\t-- "..HubMsg2.."\r\n"
tmp = tmp.."\t-- "..HubMsg3.."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
SendToAll(bot,tmp)
end

function RedirAll()
local rdstatusall = frmHub:GetRedirectAll()
local rastatus = ""
if rdstatusall == 1 then
rastatus = "on"
else
rastatus = "off"
end
return rastatus
end

function RedirFull()
local rdstatusfull = frmHub:GetRedirectFull()
local rfstatus = 0
if rdstatusfull == 1 then
rfstatus = "on"
else
rfstatus = "off"
end
return rfstatus
end

--// Profile Counter
function cProfile(what)
local disp = ""
local table,online,offline = GetUsersByProfile(what),0,0
for i, User in table do
if GetItemByName(User) then
online = online + 1
                        unregs = unregs - 1
else
offline = offline + 1
end
end
disp = disp.."Online: "..online.."\t\tOffline: "..offline
return disp
end