PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: kEwL on 14 July, 2005, 18:11:30

Title: peak script
Post by: kEwL on 14 July, 2005, 18:11:30
i want a script which records the peaks of the hub
+peaks
   =-=-=-=-= Right Now =-=-=-=-=
    - Users : 65
    - OPs : 2
    - Sharing : 1.82 TiB (2001290665599 bytes)
   =-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=

   =-=-=-=-= This Session =-=-=-=-=
    - Uptime : 1 hours, 41 minutes
    - Peak users : 71
    - Peak OPs : 3
    - Peak shared : 2.07 TiB (2279051135628 bytes)
   =-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=

   =-=-=-=-= All-Time Peaks =-=-=-=-=
    - Combined uptime of all sessions since Thursday, July 14, 2005 : 1 days, 5 hours, 10 minutes
    - Peak users : 145
    - Peak OPs : 7
    - Peak shared : 3.73 TiB (3003427593145 bytes)
   =-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=
Title: Re: peak script
Post by: Yahoo on 15 February, 2007, 14:17:04
this script is available in DDCH (DEV DIRECT CONNECT HUB) . if anyone can convert it into .lua then plzzz go a ahead. i am posting the script which is available for DDCH (.script format)
Title: peak script
Post by: Stormbringer on 15 February, 2007, 14:55:49
True, this script could be realy nice, with the ideas of kEwL
+ Few requests:

1) A timer to send this list of records in main chat with possibility to set the time of timer by cmd and RC.
2) Cmd + RC to switch between pm or main chat advertising or disable
2) In more of the request done add another record: the best sharer, with date,nick,and share size of this peak user.
3) RC for all commands
4) Possibility to send the list of records on login by pm or main chat

I hope that a good scripter could make this perfectly. Thx to this one :)
Title: Re: peak script
Post by: Yahoo on 22 March, 2007, 18:39:09
i would like to have such a script because this script not all records all time peaks but also records sessions peaks and current peaks. it would be great if someone make an attempt to create such a script for lua 5.1
Title: Re: peak script
Post by: Cêñoßy†ê on 22 March, 2007, 18:56:26
Here is start for it, this only saves and updates all time records ::)

Code (lua) Select

--[[

]]--

Records = {}
local f,e = io.open("Record.tbl", "a+" )
if f then
f:write("" )
f:close()
end
dofile("Record.tbl")

Main =function()
SetTimer(10*1000)
StartTimer()
end

OnTimer = function()
if Records.share then -- if table found
if tonumber(Records.share or 0) < frmHub:GetCurrentShareAmount() then -- is current total share bigger than in table
Records["share"] = frmHub:GetCurrentShareAmount() -- if it was we write it
SaveToFile("Record.tbl",Records, "Records") -- and save it
end
if tonumber(Records.users or 0) < frmHub:GetUsersCount() then -- is current usercount bigger than in table
Records["users"] = frmHub:GetUsersCount() -- if it was we write it
SaveToFile("Record.tbl",Records, "Records") -- and save it
end
if tonumber(Records.uptime or 0) < frmHub:GetUpTime() then -- is current uptime bigger than in table
Records["uptime"] = frmHub:GetUpTime() -- if it was we write it
SaveToFile("Record.tbl",Records, "Records") -- and save it
end
else -- if table was not found
Records = {uptime = frmHub:GetUpTime(),share = frmHub:GetCurrentShareAmount(),users = frmHub:GetUsersCount()} -- we do table
SaveToFile("Record.tbl",Records, "Records") -- and save it
end
collectgarbage("collect")
end

Serialize = function(tTable,sTableName,hFile,sTab)
sTab = sTab or ""
hFile:write(sTab..sTableName.." = {\n")
for key,value in pairs(tTable) do
if (type(value) ~= "function") then
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key)
if(type(value) == "table") then
Serialize(value,sKey,hFile,sTab.."\t")
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value)
hFile:write(sTab.."\t"..sKey.." = "..sValue)
end
hFile:write(",\n")
end
end
hFile:write(sTab.."}")
end

SaveToFile = function(file,table,tablename)
local hFile = io.open(file,"w+")
Serialize(table,tablename,hFile)
hFile:close()
end
Title: Re: peak script
Post by: Yahoo on 23 March, 2007, 05:10:13
good attempt C??o?y?e, can someone try to complete this script.