• Welcome to Valhalla Legends Archive.
 

Two diff events firing at the same time

Started by FLiPPY_, October 06, 2003, 06:38 PM

Previous topic - Next topic

FLiPPY_

Ok.. so when a user joins the channel and the bot is loaded.. it adds the username twice to the list.. and when they leave.. it only removes one.. The events
Private Const ID_USER = &H1
Private Const ID_JOIN = &H2
Must be firing at the same time..
When a user is in the channel it adds it twice also

Public Sub Event_User(strUser, strFlag, strProduct, Ping)
On Error Resume Next
Dim itmX As ListItem
   Dim clmX As ColumnHeader
   Dim intItem As Integer
   
   frmChat.lvChannel.View = lvwReport
   Set clmX = frmChat.lvChannel.ColumnHeaders.Add(, , "test")
   For intItem = 0 To 1
       Set itmX = frmChat.lvChannel.ListItems.Add(, , CStr(strUser))
       Next
AddSpeech vbGreen, "User " & strUser & " is in the channel using " & strProduct & "."
End Sub

Public Sub Event_Join(strUser, strFlag, strProduct, Ping)
On Error Resume Next
Dim myFlag As String
Dim intAccess As Integer, Icon As Integer, strFlagLock As String, boolSL As Boolean

AddSpeech vbGreen, "User " & strUser & " has joined " & TheChannel & " using " & strProduct & "."

Dim itmX As ListItem
   Dim clmX As ColumnHeader
   Dim intItem As Integer
   
   frmChat.lvChannel.View = lvwReport
   Set clmX = frmChat.lvChannel.ColumnHeaders.Add(, , "test")
   For intItem = 0 To 1
       Set itmX = frmChat.lvChannel.ListItems.Add(, , CStr(strUser))
       Next
End Sub

I dont think if you need this part.. probably not but here it is anyways

Case ID_USER
   Event_User strUser, Flags, "[" & StrReverse(Left(Message, 4)) & "]", Ping
Case ID_JOIN
   Event_Join strUser, Flags, "[" & StrReverse(Left(Message, 4)) & "]", Ping

Freeware

...  :o  :o  :o


   For intItem = 0 To 1
       Set itmX = frmChat.lvChannel.ListItems.Add(, , CStr(strUser))
       Next


Ok thats your problem right there, I dunno why you are adding the Item twice with a For statement, change it to this:


       Set itmX = frmChat.lvChannel.ListItems.Add(, , CStr(strUser))


Change that code from both Subroutines and you will be fine.