Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dc_joinlog=dc_joinlog or file.Read("logs/dc_joinlog.txt")
- local ptr=1-13
- local d=dc_joinlog
- local len=#d
- res={}
- local EVENT_JOINTIME=1
- local EVENT_DISCTIME=2
- local byte,char=string.byte,string.char
- local function proc(str)
- local date,event,value,uid=from_u_int(str),byte(str[5]),from_u_int(str,nil,5),from_u_int(str,nil,5+4)
- --Msg"[Log] "print( Format("At %s by %s: %s Time: %s",
- table.insert(res,{
- os.date("%c",date),
- uid,
- event==EVENT_JOINTIME and "join"
- or event==EVENT_DISCTIME and "leave"
- or event,
- os.prettydate(value)
- }
- )
- --)
- end
- while ptr<len-13 do
- ptr=ptr+13 -- next offset
- proc(d:sub(ptr,ptr+13-1))
- end
- local events={}
- for k,v in pairs(res) do
- events[v[2]]=events[v[2]] and events[v[2]] + 1 or 1
- end
- events2={}
- for k,v in pairs(events) do
- table.insert(events2,{k,v})
- end
- if res2 then
- table.sort(events2,function(a,b) return a[2]>b[2] end)
- for i=1,10 do
- local res=res2[events2[i][1]]
- print(res and res.name or events2[i][1],events2[i][2] .. " events")
- end
- return end
- local files=file.Find("dcraft/*")
- local i=#files+1
- res2={}
- local function proc()
- i=i-1
- local name=files[i]
- if not name then timer.Remove("LAG") print("FINITO after "..#files) return end
- local data=glon.decode(file.Read("dcraft/"..name))
- if not data then print("wat",name) error"derped" end
- res2[tonumber(data.uid)]=data
- Msg(i)
- end
- timer.Create('LAG',0,0,function()
- for i=0,10 do proc() end
- end)
Advertisement
Add Comment
Please, Sign In to add comment