Hi all
It seems that there is something wrong in the online time of the script. The hubonlinetime is:
This hub is running PtokaX DC Hub 0.3.3.21 [debug] (UpTime: 41 days, 13 hours, 28 minutes)
The script says:
?There are now 56 of the 250 users online after -2 week(s) -2 day(s) -2 hour(s) -21 minutes and -14 seconds
Can anybody explane what's wrong?
--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end
function Message(curUser)
local timeanddate = os.date("%d-%m-%Y %H:%M:%S")
local tmp = os.clock()
local weeks, days, hours, minutes, seconds = math.floor(tmp/604800), math.floor(math.mod(tmp/86400, 7)), math.floor(math.mod(tmp/3600, 24)), math.floor(math.mod(tmp/60, 60)), math.floor(math.mod(tmp/1, 60))
if frmHub:GetHubTopic() == nil then
topic = "No topic set"
else
topic = frmHub:GetHubTopic()
end
if curUser.sMyInfoString then
local disp = ""
local Description = curUser.sDescription or "No Description"
local Client = curUser.sClient or "No Client"
local ClientVersion = curUser.sClientVersion or "No ClientVersion"
doGetProfile = GetProfileName(curUser.iProfile) or "Not registerd (reg your self white !regme )"
hubshare = string.format("%0.3f", frmHub:GetCurrentShareAmount()/(tb)).." TB"
local _,_,share = string.find(curUser.sMyInfoString, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $[^$]+[^$]%$[^$]*%$%s*(%d+)%$" )
if share then
minshare = string.format("%0.3f", tonumber(share)/gb).." GB"
else
minshare = "Corrupt"
end
border1 = " --<->--------------------------------Welcome messeage for: "..curUser.sName.."--------------------------------<->--"
border2 = " --<->--------------------------------and have a nice chat and download fun "..curUser.sName.."--------------------------------<->--"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ?Hubname: "..frmHub:GetHubName().."\r\n"
disp = disp.." ?Description: "..frmHub:GetHubDescr().."\r\n"
disp = disp.." ?Local date and time: "..timeanddate.."\r\n"
disp = disp.." ?Hub Topic: "..topic.."\r\n"
disp = disp.." ?Your ip: "..curUser.sIP.."\r\n"
disp = disp.." ?Your sharesize: "..minshare.."\r\n"
disp = disp.." ?Your description is: "..curUser.sDescription.."\r\n"
disp = disp.." ?Your connection is: "..curUser.sConnection.."\r\n"
disp = disp.." ?Minshare for users: "..login.Minsharehub.."\r\n"
disp = disp.." ?Your profile: "..doGetProfile.."\r\n"
disp = disp.." ?Your client is: "..curUser.sClient.."\r\n"
disp = disp.." ?Your client version is: "..curUser.sClientVersion.."\r\n"
disp = disp.." ?Your total hubs are: "..curUser.iHubs.."\r\n"
disp = disp.." ?Your open slots are: "..curUser.iSlots.."\r\n"
disp = disp.." ?Total share in this hub: "..hubshare.."\r\n"
disp = disp.." ?Hubowner: "..login.Hubowner.."\r\n"
disp = disp.." ?Hubadress: "..frmHub:GetHubAddress()..":"..frmHub:GetHubPort().."\r\n"
disp = disp.." ?Webadress: "..login.Webadres.."\r\n"
disp = disp.." ?Forumadress: "..login.Forumadres.."\r\n"
disp = disp.." ?There are: "..ProfileCounter("NetFounder").." Netfouder(s), "..ProfileCounter("Operator").." Operator(s),\r\n"
disp = disp.." "..ProfileCounter("master").." Master(s), "..ProfileCounter("moderator").." Moderator(s),\r\n"
disp = disp.." "..ProfileCounter("Vip").." Vip(s), "..ProfileCounter("reg")..", Registered user(s).\r\n\r\n"
disp = disp.." ?There are now "..frmHub:GetUsersCount().." of the "..frmHub:GetMaxUsers().." users online after "..weeks.." week(s) "..days.." day(s) "..hours.." hour(s) "..minutes.." minutes and "..seconds.." seconds\r\n\r\n"
disp = disp.." ?Show the main commands "..login.Helpcommand.."\r\n"
disp = disp.." ?For the hub rules typ "..line6.." \r\n"
disp = disp.." ?For the "..line7.." typ "..line8.." \r\n"
disp = disp.." ?This hub is watched by: "..line54.." "..login.Botversion..""..line9.."\r\n"..border2.."\r\n"
curUser:SendData(login.BotName, disp)
disp = nil
end
end
try os.date instead of os.clock.
i remember sutch kind of a bug from timetravler on julian day, just i have no idea any more how i solved it.
plop
This function converts minutes into a human-readable message. Returns the whole human-readable string, the weeks, days, hours and mins.
Try SendToAll(minutestoh(frmHub:GetUptime()/60)). ;-)
function minutestoh(minutes) -- gets minutes as arguments, returns a string with formatted time and 4 numbers as units
if frac(minutes) > 0.5 then minutes=math.ceil(minutes) else minutes=math.floor(minutes) end
local weeks,days,hours,mins
local msg=""
local a1,a2,a3=math.mod(minutes,10080),math.mod(minutes,1440),math.mod(minutes,60)
if a1==minutes then weeks=0 else weeks=math.floor(minutes/10080) end
if a2==minutes then days=0 else days=math.floor(a1/1440) end
if a3==minutes then hours=0 else hours=math.floor(a2/60) end
mins=math.mod(minutes,60)
local tmp=
{
[" weeks "]=weeks,
[" days "]=days,
[" hours "]=hours,
[" minutes"]=mins
}
local tmp2={" weeks "," days "," hours "," minutes"}
for a,b in ipairs(tmp2) do
if tmp[b] > 0 then
msg=msg..tmp[b]..b
end
end
if msg=="" then msg="0" end
return msg,weeks,days,hours,mins
end
Thnx all.
I will try all of it.
try os.date instead of os.clock.
i remember sutch kind of a bug from timetravler on julian day, just i have no idea any more how i solved it.
plop
Sorry, don't work
On the other hand...
you could use
code:--------------------------------------------------------------------------------frmHub:GetUptime()--------------------------------------------------------------------------------
..returns uptime in seconds
Works. But that isn't not what i want.
bastya_elvtars
I try to put you're code in.
I can't get it work ~s
Sorry, I am dumb, minutestoh returns more variables. Use px_console and print.