• Welcome to Valhalla Legends Archive.
 

More ping help

Started by TeEhEiMaN, June 20, 2004, 04:22 PM

Previous topic - Next topic

TeEhEiMaN

alright i need help with this code, no errors it just dont work, im trying to add the ping where, getpingicon is, i made the function but i suck at making them, so i need some help with it.


        ElseIf Client = "PXES" Then
       Form1.Channel.ListItems.Add , , UserName, , 9
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , getpingicon



Public Function getpingicon(ByVal Ping As Long, Optional ByVal Flags As Long) As Integer
Dim getpingicon As Integer
If Ping >= 500 Then getpingicon = 20
ElseIf Ping >= 400 Then getpingicon = 19
ElseIf Ping >= 300 Then getpingicon = 18
ElseIf Ping >= 200 Then getpingicon = 17
ElseIf Ping >= 100 Then getpingicon = 16
ElseIf Ping < 100 Then getpingicon = 15
End If
End Function

GoSuGaMING

#1
try something like this


If (Ping >= 5) And (Ping <= 199) Then
   IconCode = ICON_LAG1
End If
If (lPing >= 200) And (Ping <= 300) Then
   IconCode = ICON_LAG2
End If
If (lPing >= 301) And (Ping <= 400) Then
   IconCode = ICON_LAG3
End If
If (lPing >= 401) And (Ping <= 600) Then
   IconCode = ICON_LAG4
End If
If (Ping >= 601) And (Ping <= 1200) Then
  IconCode = ICON_LAG5
End If
If Ping > 1201 Then
   IconCode = ICON_LAG6
End If
If (Ping < 0) Then
   IconCode = ICON_LAG6
End If
If (Ping = 0) Then
   IconCode = 0
End If

GetPingIcon= IconCode

TeEhEiMaN

#2
I tryed your way but, but my problem is the varuables, im pretty sure my codeing aint correct

GoSuGaMING

Quote from: TeEhEiMaN on June 20, 2004, 05:15 PM
I tryed your way but, but my problem is the varuables, im pretty sure my codeing aint correct

show me what you have so far

Soul Taker

Quote from: GoSuGaMING on June 20, 2004, 05:14 PM
try something like this


If (Ping >= 5) And (Ping <= 199) Then
   IconCode = ICON_LAG1
End If
If (lPing >= 200) And (Ping <= 300) Then
   IconCode = ICON_LAG2
End If
If (lPing >= 301) And (Ping <= 400) Then
   IconCode = ICON_LAG3
End If
If (lPing >= 401) And (Ping <= 600) Then
   IconCode = ICON_LAG4
End If
If (Ping >= 601) And (Ping <= 1200) Then
  IconCode = ICON_LAG5
End If
If Ping > 1201 Then
   IconCode = ICON_LAG6
End If
If (Ping < 0) Then
   IconCode = ICON_LAG6
End If
If (Ping = 0) Then
   IconCode = 0
End If

GetPingIcon= IconCode

What if someone has a ping of 3?  No lag icon should be from 0 to 8 ms.

TeEhEiMaN

#5
i dont need really any help on the actual getting the ping code its more getting the function to work. like

Public Function pooo()
pooo = 1

end function


Public Sub parsep()
If Client = PXES then
form1.list.add pooo
end sub

then pooo would come out to be 1. so i must be doing something wrong cause it doesnt work.

Spht

Quote from: GoSuGaMING on June 20, 2004, 05:14 PM
try something like this


If (Ping >= 5) And (Ping <= 199) Then
   IconCode = ICON_LAG1
End If
If (lPing >= 200) And (Ping <= 300) Then
   IconCode = ICON_LAG2
End If
If (lPing >= 301) And (Ping <= 400) Then
   IconCode = ICON_LAG3
End If
If (lPing >= 401) And (Ping <= 600) Then
   IconCode = ICON_LAG4
End If
If (Ping >= 601) And (Ping <= 1200) Then
  IconCode = ICON_LAG5
End If
If Ping > 1201 Then
   IconCode = ICON_LAG6
End If
If (Ping < 0) Then
   IconCode = ICON_LAG6
End If
If (Ping = 0) Then
   IconCode = 0
End If

GetPingIcon= IconCode


You're using incorrect logic there.  I posted this a while back...

(ping being an unsigned long)

   Ping Is < 10
       ' No latency bars
   Ping Is < 200
       ' ONE latency bar
   Ping Is < 300
       ' TWO latency bars
   Ping Is < 400
       ' THREE latency bars
   Ping Is < 500
       ' FOUR latency bars
   Ping Is < 600
       ' FIVE latency bars
   Ping Is >= 600
       ' SIX latency bars

TeEhEiMaN

i can write my own ping code, i just need help with what i said on the last message

Spht

Quote from: TeEhEiMaN on June 20, 2004, 05:56 PM
i can write my own ping code, i just need help with what i said on the last message

You're calling getpingcode with no parameters.

Quote from: TeEhEiMaN on June 20, 2004, 04:22 PM

       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , getpingicon

It should be something like... (depending on the name of your variables)

       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , getpingicon(Ping, Flags)

TeEhEiMaN

Alright this codes kinda messy, need some help with it. The problems that happen, is when it add's a ping to the user, it will add the ping twice, so 2 icons behind the username, but it only does it on a list of like 2 out 30 people. Also this code aint workin for me to well If flag = 16 Then GetLagIcon = 21, its at the bottom of the first code.




Public Function GetLagIcon(ByVal Ping As Long, Optional ByVal flag As Long) As Integer
Dim IconCode As Integer


If (Ping >= 5) And (Ping <= 199) Then
   GetLagIcon = 15
End If
If (Ping >= 200) And (Ping <= 300) Then
   GetLagIcon = 16
End If
If (Ping >= 301) And (Ping <= 400) Then
   GetLagIcon = 17
End If
If (Ping >= 401) And (Ping <= 600) Then
   GetLagIcon = 18
End If
If (Ping >= 601) And (Ping <= 1200) Then
  GetLagIcon = 19
End If
If Ping > 1201 Then
   GetLagIcon = 20
End If
If (Ping < 0) Then
   GetLagIcon = 15
End If
If flag = 16 Then
           GetLagIcon = 21
           End If
End Function


Heres the add user code,


If flag = 2 Or flag = 18 Then
       Form1.Channel.ListItems.Add 1, , UserName, , 1
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
         ElseIf Client = "PXES" Then
       Form1.Channel.ListItems.Add , , UserName, , 9
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
               ElseIf Client = "RATS" Then
       Form1.Channel.ListItems.Add , , UserName, , 6
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
               ElseIf Client = "VD2D" Then
       Form1.Channel.ListItems.Add , , UserName, , 5
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
               ElseIf Client = "NB2W" Then
       Form1.Channel.ListItems.Add , , UserName, , 10
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
               ElseIf Client = "PX2D" Then
       Form1.Channel.ListItems.Add , , UserName, , 13
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
               ElseIf Client = "3RAW" Then
       Form1.Channel.ListItems.Add , , UserName, , 61
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
         ElseIf Client = "PX3W" Then
       Form1.Channel.ListItems.Add , , UserName, , 65
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
            ElseIf Client = "TAHC" Then
       Form1.Channel.ListItems.Add , , UserName, , 2
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN
           Else
       Form1.Channel.ListItems.Add , , UserName, , 12
       Form1.Channel.ListItems.Item(Form1.Channel.ListItems.Count).ListSubItems.Add 1, , , lagicoN