Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: GoSu_KaOs on November 07, 2004, 11:18 PM

Title: Removing user on leave
Post by: GoSu_KaOs on November 07, 2004, 11:18 PM
Cant get this to work.

This is my code under ID_LEAVE:

Case ID_LEAVE

frmMain.Channelcount.Text = frmMain.ChannelList.ListItems.Count - 1

If frmConfig.Check5 = vbChecked Then
    AddC RGB(0, 184, 0), Username & " has left the channel" & " [ " & Ping & " ]"
End If

For X = 1 To frmMain.ChannelList.ListItems.Count
  If frmMain.ChannelList.ListItems.Item(X).Text = Username Then
    frmMain.ChannelList.ListItems.Remove Username
End If
Next X


End Select
Exit Function

End Function


It doesent do anything. When the user leaves, the "has left the channel." message showes up. But it doesn't remove the username.
Title: Re: Removing user on leave
Post by: Yegg on November 08, 2004, 05:59 PM
for the removing part u only need 1 main line,

lvChannel.ListItems.Remove (lvChannel.FindItem(username).index)

also, for ur stuff like ID_USER, ID_JOIN etc, u should use a class module so that code can be put into ur main form. i think it would b much more organized and readable that way.