Commands: .hitstoday : it says the number of visitors todayCode:'visitors '2.0 ' ^ Version Required ^ ' Plugin Script ' Designed and Scripted By: ' Warlock Public visitor_fso Set visitor_fso = CreateObject("Scripting.FileSystemObject") Public visitor_myFile Public total_hits, distinct_hits, total_today, distinct_today Public creation_date, current_date, creation_channel '// Fires once for each user in the channel upon joining a channel. Sub visitors_Event_Load() if not visitor_fso.fileExists(BotPath() & "visitors.txt") then total_hits = 0 distinct_hits = 0 total_today = 0 distinct_today = 0 creation_date = Date current_date = Date creation_channel = BotVars.HomeChannel else Set visitor_myFile = visitor_fso.OpenTextFile(BotPath() & "visitors.txt", 1, True) if visitor_myFile.atEndOfStream then total_hits = 0 distinct_hits = 0 total_today = 0 distinct_today = 0 creation_date = Date current_date = Date creation_channel = BotVars.HomeChannel else total_hits = cLng(visitor_myFile.readLine) distinct_hits = cLng(visitor_myFile.readLine) total_today = cLng(visitor_myFile.readLine) distinct_today = cLng(visitor_myFile.readLine) current_date = cDate(visitor_myFile.readLine) creation_date = cDate(visitor_myFile.readLine) if current_date <> Date then total_today = 0 distinct_today = 0 current_date = Date end if creation_channel = visitor_myFile.readLine end if visitor_myFile.close end if End Sub '// Fires when a user on battle.net talks. Sub visitors_Event_UserTalk(Username, Flags, Message, Ping) if LCase(Message) = Trim(BotVars.Trigger & "visitors") or LCase(Message) = Trim(BotVars.Trigger & "visitorstotal") or LCase(Message) = Trim(BotVars.Trigger & "hitstotal")then GetDBEntry Username, myAccess, myFlags if myAccess > 40 then vetothismessage() addq "Total hits since " & creation_date & ": " & total_hits addq "Total distinct visitors: " & distinct_hits end if end if if LCase(Message) = Trim(BotVars.Trigger & "visitorstoday") or LCase(Message) = Trim(BotVars.Trigger & "hitstoday") then GetDBEntry Username, myAccess, myFlags if myAccess > 40 then vetothismessage() addq "Total hits today: " & total_today addq "Distinct visitors today: " & distinct_today end if end if End Sub '// Fires when a whisper is recieved. Sub visitors_Event_WhisperFromUser(Username, Flags, Message) Call visitors_Event_UserTalk(Username, Flags, Text, -3) End Sub Sub visitors_Event_PressedEnter(Text) Call visitors_Event_UserTalk(BotVars.Username, 0, Text, -4) End Sub Sub visitors_Event_UserJoins(Username, Flags, Message, Ping, Product, Level, OriginalStatstring) if lcase(BotVars.HomeChannel) = lcase(myChannel) then total_hits = cLng(total_hits) + 1 if Date <> current_date then current_Date = Date distinct_today = 1 total_today = 1 Set visitor_myFile = visitor_fso.OpenTextFile(BotPath() & "visitorlist.txt", 2, True) visitor_myFile.writeLine Username visitor_myFile.close end if total_today = cLng(total_today) + 1 if not cBool(hasSeen(Username)) then distinct_hits = cLng(distinct_hits) + 1 distinct_today = cLng(distinct_today) + 1 writeVisitor(Username) end if end if End Sub Sub visitors_Event_Close() Set visitor_myFile = visitor_fso.OpenTextFile(BotPath() & "visitors.txt", 2, True) visitor_myFile.writeLine total_hits visitor_myFile.writeLine distinct_hits visitor_myFile.writeLine total_today visitor_myFile.writeLine distinct_today visitor_myFile.writeLine current_date visitor_myFile.writeLine creation_date visitor_myFile.writeLine creation_channel visitor_myFile.close End Sub '************************************** Sub writeVisitor(Username) Set visitor_myFile = visitor_fso.OpenTextFile(BotPath() & "visitorlist.txt", 8, True) visitor_myFile.writeLine Username visitor_myFile.close End Sub '************************************** Function hasSeen(username) hasSeen = true if FindLine(BotPath() & "visitorlist.txt", username) = 0 then hasSeen = false end if End Function '************************************** Function FindLine(filepath,text) Dim Content, Count Content=ReadText(filepath) vLines = Split(content, vbCrLf) Count=1 FindLine=0 For Each vLine in vLines If InStr(vline,text) Then FindLine=Count Exit For End If Count=Count+1 Next End Function '************************************** Function ReadText(filepath) Set FSO = CreateObject("Scripting.FileSystemObject") Dim File ReadText="" If FSO.FileExists(filepath) Then Set File = FSO.GetFile(filepath) If CInt(file.size)=0 Then ReadText="" Else Set File = FSO.OpenTextFile(filepath,1) ReadText=File.ReadAll End If End If End Function
.Hitstotal : it says the number of vivitors total


LinkBack URL
About LinkBacks
Reply With Quote
