Valhalla Legends Forums Archive | Visual Basic Programming | WildCards & Weird Repition

AuthorMessageTime
CrAz3D
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.

[code]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[/code]

Any HELP is apreciated.
February 16, 2004, 3:44 PM
o.OV
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"
February 16, 2004, 8:11 PM
Stealth
Yes, you can't even begin to figure out what's wrong until you remove On Error Resume Next.
February 16, 2004, 8:33 PM

Search