Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --| Chat Logger for HHFH by hjpotter92 and Brick
- dofile("scripts/libsimplepickle.lua")
- if not count then
- count ={}
- end
- local p = io.open( "scripts/ChatLogs/count.txt", "r" )
- if p then
- dofile("scripts/ChatLogs/count.txt")
- p:close()
- end
- dcpp:setListener( "chat", "monologue",
- function( hub,user,text)
- local name = "scripts/ChatLogs/"..os.date( "%Y" ).."/"..os.date( "%m" ).."/"..os.date("%d").."_"..os.date("%m").."_"..os.date("%Y")..".txt"
- local f = io.open (name,"a")
- local a= "["..os.date("%I")..":"..os.date("%M").." "..os.date("%p").."] ".."<"..user:getNick().."> "..text
- f:write(a.."\n")
- f:flush()
- f:close()
- if not count[user:getNick()] then
- count[user:getNick()] =0
- end
- count[user:getNick()] = count[user:getNick()] + 1
- local tempVar = count[user:getNick()]
- local cent = tempVar - math.floor( tempVar/100 ) * 100
- if cent == 0 then
- hub:sendChat(".say hjpotter92 The user "..user:getNick().." just punched 100th line on mainchat. The current count being: "..count[user:getNick()] )
- end
- pickle.store("scripts/ChatLogs/count.txt",{count=count})
- end
- )
- local h = io.open( "scripts/ChatLogs/chatLogHelp.txt", "r" )
- local totcounts = h:read( "*a" )
- dcpp:setListener( "pm", "response",
- function( hub, user, text )
- local p = io.open( "scripts/ChatLogs/count.txt", "r" )
- local fileData = p:read( "*a" )
- p:close()
- local s = string.lower( text )
- if string.find( s, "score" ) then
- user:sendPrivMsgFmt( "\r\t"..user:getNick()..", your score is "..count[user:getNick()]..".\n\tBot designed by Brick and hjpotter92.", 1 )
- elseif string.find( s, "help" ) then
- user:sendPrivMsgFmt( totcounts, 1)
- elseif string.find( s, "count" ) then
- user:sendPrivMsgFmt( fileData, 1)
- end
- end
- )
- DC():PrintDebug( " ** Loaded Chat Log.lua **" )
Add Comment
Please, Sign In to add comment