• Welcome to Valhalla Legends Archive.
 

If statement help

Started by blinkdude, July 15, 2003, 12:24 AM

Previous topic - Next topic

blinkdude

My if statement is wrong i know :/ i trying to see who has flags "2" in the channel and gives them the "OP" icon

Private Sub CleanSlateBot1_UserInChannel(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, StatUpdate As Boolean, SimulatedEvent As Boolean)

Dim MyItem As ListItem
Set MyItem = ListView1.ListItems.Add()

If Username(Flags) = 2 Then
MyItem.SmallIcon = 1

MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"
Else
Select Case Product
Case "WAR3": MyItem.SmallIcon = 13
Case "D2DV": MyItem.SmallIcon = 12
Case "STAR": MyItem.SmallIcon = 8
Case "D2XP": MyItem.SmallIcon = 12
Case "SEXP": MyItem.SmallIcon = 11
Case "W2BN": MyItem.SmallIcon = 9
Case "TAHC": MyItem.SmallIcon = 10
Case "W3XP": MyItem.SmallIcon = 10
End Select
MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"


End If
End Sub
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

blinkdude

n/m i got it :/

Private Sub CleanSlateBot1_UserInChannel(ByVal Username As String, ByVal flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, StatUpdate As Boolean, SimulatedEvent As Boolean)

Dim MyItem As ListItem
Set MyItem = ListView1.ListItems.Add()
If LCase(flags) = 2 Then
MyItem.SmallIcon = 1

MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"
Else
Select Case Product
Case "WAR3": MyItem.SmallIcon = 13
Case "D2DV": MyItem.SmallIcon = 12
Case "STAR": MyItem.SmallIcon = 8
Case "D2XP": MyItem.SmallIcon = 12
Case "SEXP": MyItem.SmallIcon = 11
Case "W2BN": MyItem.SmallIcon = 9
Case "TAHC": MyItem.SmallIcon = 10
Case "W3XP": MyItem.SmallIcon = 10
End Select
MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"

End If

End Sub
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

Soul Taker

Why are you lcasing() a long?
Also, remove the two instances of

MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"

and put it once outside the if statement.
And I strongly urge you use a bitwise comparison to determine the icon from flags.

blinkdude

yes it takes a while to ban and my code is sloopy but it works :/ ... ip banning is so fun... :)
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

Soul Taker

If you don't use a bitwise comparison, someone without UDP support will be able to dodge your IP bans.