new channel visitors

This is a discussion on new channel visitors within the Stealthbot Plugins forum part of the Stealthbot category; Code: 'visitors '2.0 ' ^ Version Required ^ ' Plugin Script ' Designed and Scripted By: ' Warlock Public visitor_fso ...


+ Reply to Thread
Results 1 to 5 of 5

Thread: new channel visitors

  1. #1
    lolercakess's Avatar
    lolercakess is offline Member
    lolercakess is on a distinguished road
    Join Date
    Jul 2007
    Posts
    48
    Downloads
    19
    Uploads
    0
    Rep Power
    3
    Reputation
    36

    new channel visitors

    Code:
    '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
    
    Commands: .hitstoday : it says the number of visitors today
    .Hitstotal : it says the number of vivitors total

  2. #2
    Lov33 is offline Newbie
    Lov33 is an unknown quantity at this point
    Join Date
    Oct 2008
    Posts
    1
    Downloads
    8
    Uploads
    0
    Rep Power
    2
    Reputation
    0
    Thanks man, this was great!

  3. #3
    TdC
    TdC is offline Newbie
    TdC is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    9
    Downloads
    0
    Uploads
    0
    Rep Power
    2
    Reputation
    0
    how makes tone so that the clan or and the club foot counts the clan not as visitors

  4. #4
    xiN
    xiN is offline The Almighty Frenchie
    xiN is a jewel in the rough xiN is a jewel in the rough xiN is a jewel in the rough xiN is a jewel in the rough
    Join Date
    Feb 2007
    Location
    Six feet under
    Posts
    1,714
    Downloads
    25
    Uploads
    4
    Rep Power
    5
    Reputation
    333
    Be clearer please.

  5. #5
    TdC
    TdC is offline Newbie
    TdC is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    9
    Downloads
    0
    Uploads
    0
    Rep Power
    2
    Reputation
    0
    its good sry for to have you upset

+ Reply to Thread

Similar Threads

  1. D2 Clone Guide
    By KaMiKaZe in forum Diablo 2 forum
    Replies: 3
    Last Post: 02-11-2008, 12:25 AM
  2. >> CHANNEL VISITORS - PLUG <<
    By T[X]AS in forum Stealthbot Plugins
    Replies: 2
    Last Post: 04-17-2007, 11:20 AM
  3. Can someone provide a bot for channel Clan D3 ?
    By hendricius in forum Warcraft 3 forum
    Replies: 15
    Last Post: 04-03-2007, 12:50 PM
  4. No IRC channel ?
    By Blaze in forum Warcraft 3 forum
    Replies: 2
    Last Post: 03-11-2007, 07:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Dboyz Interactive Skillhackers