Is it possible to have invisible or hidden users in your hub. Im using a script called Top10 or something like that. And when I use the command +TopOnliner it shows two people in the top 10 list that are never in the hub....matter a fact I have never seen them at all, but they always show up as being there all the time. Any solution to this?
QuoteOriginally posted by Jabo
Is it possible to have invisible or hidden users in your hub. Im using a script called Top10 or something like that. And when I use the command +TopOnliner it shows two people in the top 10 list that are never in the hub....matter a fact I have never seen them at all, but they always show up as being there all the time. Any solution to this?
sounds like a bug in the script, script doesn't proces them when leaving the hub.
might be easyer if you post the script so ppl can look @ it and hopefully find the bug if it's a bug.
plop
Heres the script that I'm using...
Tlist = {["Onliners"]={["login"]={}, ["Time"]={}}}
list = {["Kickers"]={}, ["Chatters"]={}, ["Banners"]={}}
nr = 10 --<-------Numbers of "Toppers" You want to show
limit = 15 --<-------Limitter for Time-counter, to filter away "short-time" visitors.Set in minutes.
Timefile = "Timer.txt"
Kickerfile = "Kickers.txt"
function Main()
Tlist = loadTableFromFile(Timefile)
list=loadTableFromFile(Kickerfile)
end
function DataArrival(curUser, sData)
if ( strsub(sData, 1, 5) == "$Kick" ) then
list.Kickers[curUser.sName] = list.Kickers[curUser.sName] or 0
list.Kickers[curUser.sName] = list.Kickers[curUser.sName]+1
saveTableToFile(Kickerfile,list)
elseif( strsub(sData, 1, 1) == "<" ) then
list.Chatters[curUser.sName] = list.Chatters[curUser.sName] or 0
list.Chatters[curUser.sName] = list.Chatters[curUser.sName]+1
saveTableToFile(Kickerfile,list)
end
if( strsub(sData, 1, 1) == "<" ) then
sData=strsub(sData,1,strlen(sData)-1)
s,e,cmd = strfind( sData, "%b<>%s+(%S+)" )
if (cmd=="!nickban") or (cmd=="!ban") then
list.Banners[curUser.sName] = list.Banners[curUser.sName] or 0
list.Banners[curUser.sName] = list.Banners[curUser.sName]+1
saveTableToFile(Kickerfile,list)
elseif (cmd=="+TopKicker") and (curUser.bOperator) then
local curtime = date()
SendToNick(curUser.sName,"\r\n\tTOP KICKER\t\t("..curtime..")\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n")
local Index = sorting(list.Kickers)
for i = 1, Index.n do
local key = Index
SendToNick(curUser.sName, "**** "..i.." [ "..key.." ]\t\t=>\t"..list.Kickers[key])
SendToNick(curUser.sName,"-----------------------------------------------------------------------------------------------------------")
if i>=nr then break end
end
return 1
elseif (cmd=="+TopChatter") then
local curtime = date()
SendToNick(curUser.sName,"\r\n\tTOP CHATTER\t\t("..curtime..")\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n")
local Index = sorting(list.Chatters)
for i = 1, Index.n do
local key = Index
SendToNick(curUser.sName, "**** "..i.." [ "..key.." ]\t\t=>\t"..list.Chatters[key])
SendToNick(curUser.sName,"-----------------------------------------------------------------------------------------------------------")
if i>=nr then break end
end
return 1
elseif (cmd=="+TopBanner") and (curUser.bOperator) then
local curtime = date()
SendToNick(curUser.sName,"\r\n\tTOP BANNER\t\t("..curtime..")\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n")
local Index = sorting(list.Banners)
for i = 1, Index.n do
local key = Index
SendToNick(curUser.sName, "**** "..i.." [ "..key.." ]\t\t=>\t"..list.Banners[key])
SendToNick(curUser.sName,"-----------------------------------------------------------------------------------------------------------")
if i>=nr then break end
end
return 1
elseif (cmd=="+TopOnliner") then
local curtime = date()
local now = Calc(Tlist.Onliners.login, Tlist.Onliners.Time)
SendToNick(curUser.sName,"\r\n\tTOP ONLINER\t\t\t\t("..curtime..")\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n")
local Index = sorting(now)
for i = 1, Index.n do
local key = Index
local days, hrs, min = Timemess(now[key])
SendToNick(curUser.sName, "**** "..i.." [ "..key.." ] has been here for; "..days.." days, "..hrs.." hours and "..min.." minutes")
SendToNick(curUser.sName,"-----------------------------------------------------------------------------------------------------------------------------------------------")
if i>=nr then break end
end
return 1
elseif (cmd=="+MyTime") then
local curtime = date()
usrtime = MyTime(Tlist.Onliners.login, Tlist.Onliners.Time, curUser)
local days, hrs, min = Timemess(usrtime)
SendToNick(curUser.sName,"*** You have been here for "..days.." days, "..hrs.." hours and "..min.." minutes in this hub \t( "..curtime.." )" )
return 1
end
end
end
function sorting(table)
local index = {n=0}
foreach(table, function(key, value) tinsert(%index, key) end)
local func = function(a, b) return %table[a] > %table end
sort(index, func) return index
end
function loadTableFromFile(file)
readfrom(file)
local aString = read("*all")
return unpickle(aString)
end
function saveTableToFile(file,table)
local aString = pickle(table)
writeto(file)
write(aString)
writeto()
end
function NewUserConnected(curUser)
local minute = Jmn(a)
Tlist.Onliners.login[curUser.sName] = Tlist.Onliners.login[curUser.sName] or 0
Tlist.Onliners.login[curUser.sName] = tonumber(minute)
Tlist.Onliners.Time[curUser.sName] = Tlist.Onliners.Time[curUser.sName] or 0
Tlist.Onliners.Time[curUser.sName] = Tlist.Onliners.Time[curUser.sName] + tonumber(minute) - tonumber(Tlist.Onliners.login[curUser.sName])
saveTableToFile(Timefile,Tlist)
end
function UserDisconnected(curUser)
local minute = Jmn(a)
if Tlist.Onliners.login[curUser.sName] == nil then
Tlist.Onliners.Time[curUser.sName] = nil
else
Tlist.Onliners.Time[curUser.sName] = Tlist.Onliners.Time[curUser.sName] or 0
Tlist.Onliners.Time[curUser.sName] = Tlist.Onliners.Time[curUser.sName] + tonumber(minute) - tonumber(Tlist.Onliners.login[curUser.sName])
if Tlist.Onliners.Time[curUser.sName] <= limit then
Tlist.Onliners.Time[curUser.sName] = nil
Tlist.Onliners.login[curUser.sName] = nil
else
Tlist.Onliners.login[curUser.sName] = nil
saveTableToFile(Timefile,Tlist)
end
end
end
function OpConnected(curUser)
local minute = Jmn(a)
Tlist.Onliners.login[curUser.sName] = Tlist.Onliners.login[curUser.sName] or 0
Tlist.Onliners.login[curUser.sName] = tonumber(minute)
Tlist.Onliners.Time[curUser.sName] = Tlist.Onliners.Time[curUser.sName] or 0
Tlist.Onliners.Time[curUser.sName] = Tlist.Onliners.Time[curUser.sName] + tonumber(minute) - tonumber(Tlist.Onliners.login[curUser.sName])
saveTableToFile(Timefile,Tlist)
end
function OpDisconnected(curUser)
local minute = Jmn(a)
if Tlist.Onliners.login[curUser.sName] == nil then
Tlist.Onliners.Time[curUser.sName] = nil
else
Tlist.Onliners.Time[curUser.sName] = Tlist.Onliners.Time[curUser.sName] or 0
Tlist.Onliners.Time[curUser.sName] = Tlist.Onliners.Time[curUser.sName] + tonumber(minute) - tonumber(Tlist.Onliners.login[curUser.sName])
if Tlist.Onliners.Time[curUser.sName] <= limit then
Tlist.Onliners.Time[curUser.sName] = nil
Tlist.Onliners.login[curUser.sName] = nil
else
Tlist.Onliners.login[curUser.sName] = nil
saveTableToFile(Timefile,Tlist)
end
end
end
function Calc(a, c)
local indeX = {}
foreach(a, function(key,value)
for key, value in %a do
for key2, value2 in %c do
if (key == key2) then
local minute = Jmn()
local diff = tonumber(value2) + minute - tonumber(value)
rawset(%indeX, key, diff) end end end end)
return indeX
end
function MyTime(a, c, curUser)
local minute = Jmn()
local onTime =""
for key, value in a do
for key2, value2 in c do
if key == curUser.sName
and key2 == curUser.sName then
onTime = tonumber(value2) + minute - tonumber(value)
return onTime
end
end
end
end
function Jmn() --(Modified Julian "minute" number. This restricts the algorithm to 1900 Mar 01 until 2100 Feb 28)
D = tonumber(date("%d"))
H = tonumber(date("%H"))
minutE = tonumber(date("%M"))
Y = tonumber(date("%Y"))
M = tonumber(date("%m"))
if M <= 2 then
M = M + 12
Y=Y-1
end
mn = 1440*(floor(Y*365,25) + floor((M+1)*30,6) + D -428) + H*60 + minutE
return mn
end
function Timemess(T)
local min = tonumber(T)
local days = floor(min/1440)
local hrs = floor((min-(days*1440))/60)
min = floor(min-(days*1440)-(hrs*60))
return days, hrs, min
end
----------------------------------------------
-- Pickle.lua
-- An table serialization utility for lua
-- Steve Dekorte, Apr 2000
-- Freeware
----------------------------------------------
function pickle(t)
return Pickle:clone():pickle_(t)
end
Pickle = {
clone = function (t) local nt={}; for i, v in t do nt=v end return nt end
}
function Pickle:pickle_(root)
if type(root) ~= "table" then
error("can only pickle tables, not ".. type(root).."s")
end
self._tableToRef = {}
self._refToTable = {}
local savecount = 0
self:ref_(root)
local s = ""
while getn(self._refToTable) > savecount do
savecount = savecount + 1
local t = self._refToTable[savecount]
s = s.."{\n"
for i, v in t do
s = format("%s[%s]=%s,\n", s, self:value_(i), self:value_(v))
end
s = s.."},\n"
end
return format("{%s}", s)
end
function Pickle:value_(v)
local vtype = type(v)
if vtype == "string" then return format("%q", v)
elseif vtype == "number" then return v
elseif vtype == "table" then return "{"..self:ref_(v).."}"
else --error("pickle a "..type(v).." is not supported")
end
end
function Pickle:ref_(t)
local ref = self._tableToRef[t]
if not ref then
if t == self then error("can't pickle the pickle class") end
tinsert(self._refToTable, t)
ref = getn(self._refToTable)
self._tableToRef[t] = ref
end
return ref
end
----------------------------------------------
-- unpickle
----------------------------------------------
function unpickle(s)
if type(s) ~= "string" then
error("can't unpickle a "..type(s)..", only strings")
end
local tables = dostring("return "..s)
for tnum = 1, getn(tables) do
local t = tables[tnum]
local tcopy = {}; for i, v in t do tcopy = v end
for i, v in tcopy do
local ni, nv
if type(i) == "table" then ni = tables[i[1]] else ni = i end
if type(v) == "table" then nv = tables[v[1]] else nv = v end
t[ni] = nv
end
end
return tables[1]
end
-- Finish Copying