Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: CrAz3D on February 16, 2004, 09:44 AM

Title: WildCards & Weird Repition
Post by: CrAz3D on February 16, 2004, 09:44 AM
My wild card function will kick or ban the user I am looking for, however it will keep repeating the ban/kick the same user for the rest of the # of the channel users after the username is found then will go onto the next user.

Public Function WildBan(Username As String, Position As String, Thing As String)
On Error Resume Next
Dim user As String, sUser As String, intUser As Integer, iY As Integer
intUser = Len(Username)
For iY = 1 To Form1.RoomList.ListItems.Count
   sUser = Form1.RoomList.ListItems(iY).text
   sUser = LCase(sUser)
   Username = LCase(Username)

If Left(sUser, intUser) = Username Or Right(sUser, intUser) = Username Or Mid(sUser, intUser) Then

If Left(sUser, intUser) = Username And Position = "Right" Then
   user = sUser
ElseIf Right(sUser, intUser) = Username And Position = "Left" Then
   user = sUser
ElseIf InStr(sUser, Username) > 0 And Position = "Mid" Then
   user = sUser
End If

End If

Select Case LCase(Thing)
   Case "ban"
       Ban user, " (WILDCARD Ban)"
   Case "kick"
       Send "/kick " & user, True
       
End Select
   Next iY


End Function


Any HELP is apreciated.
Title: Re:WildCards & Weird Repition
Post by: o.OV on February 16, 2004, 02:11 PM
place your case selection inside the if then block
and you should learn how to debug..
for starters.
learn to NOT use "On Error Resume Next"
Title: Re:WildCards & Weird Repition
Post by: Stealth on February 16, 2004, 02:33 PM
Yes, you can't even begin to figure out what's wrong until you remove On Error Resume Next.