Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Main menu Total players online:


manbearpig
 Share

Recommended Posts

Hello every one! blue here and i have a question/Request Does any one know how i can put a thing on my main menu saying Total Players Online: (Player amount here)

Ive looked in the source index :P and cant find it i dont think any one made it yet =D if you know pm me or post it =)

Thank you

Any help is appreciated.
Link to comment
Share on other sites

If you don't even know how all that works, why bother trying it? There is a packet named 'top' in Eclipse by default… Use that, look it up in the server, and see what it returns... Come on, it's not THAT hard... That's basic stuff :/
Link to comment
Share on other sites

```
Sub SendOnlineList()
    Dim packet As String
    Dim PlayerCount As Long
    Dim i As Long

    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) Then
            packet = packet & SEP_CHAR & GetPlayerName(i) & SEP_CHAR
            PlayerCount = PlayerCount + 1
        End If
    Next i

    Call SendDataToAll("ONLINELIST" & SEP_CHAR & PlayerCount & packet & END_CHAR)
End Sub
```
```
    ' ::::::::::::::::::::::::::
    ' :: Get Online List ::
    ' ::::::::::::::::::::::::::
    If casestring = "onlinelist" Then
        frmMirage.lstOnline.Clear

        n = 2
        z = Val(parse(1))
        For x = n To (z + 1)
            frmMirage.lstOnline.addItem Trim$(parse(n))
            n = n + 2
        Next x
        Exit Sub
    End If
```
Alter this to be usable from the main menu.
Link to comment
Share on other sites

Ok. Got it. It works.

Client Side
**Add a label to frmMainMenu called lblPlayers, then add the codes bellow as it sais:**

```
        lblOnline.Caption = "Offline"
        lblOnline.ForeColor = vbRed
    End If

``````
    Call SendData("getonline" & END_CHAR)

```
```
    If (casestring = "playernewxy") Then
        X = Val(parse(1))
        y = Val(parse(2))

        If Not GetPlayerX(MyIndex) = X Then Call SetPlayerX(MyIndex, X)
        If Not GetPlayerY(MyIndex) = y Then Call SetPlayerY(MyIndex, y)

        Exit Sub
    End If

``````
    If (casestring = "totalonline") Then
        frmMainMenu.lblPlayers.Caption = "Players Online: " & Trim(parse(1))
        Exit Sub
    End If

```
ServerSide
**No controls to add here, just code edits.**

```
        Case "getclasses"
            Call Packet_GetClasses(Index)
            Exit Sub

``````
        Case "getonline"
            Call Packet_GetWhosOnline(Index)
            Exit Sub

```
```
Public Sub Packet_GetWhosOnline(ByVal Index)
    Call SendDataTo(Index, "totalonline" & SEP_CHAR & TotalOnlinePlayers & END_CHAR)
End Sub

```
Credits
No credits needed, you can steal this tutorial and this code and claim it as your own for as much as I care. It tooks like, 3 minutes to do which is nothing.
Link to comment
Share on other sites

Thanks so much but what does this mean whats add after??
Code: (Add After) [Select]
    If (casestring = "totalonline") Then
        frmMainMenu.lblPlayers.Caption = "Players Online: " & Trim(parse(1))
        Exit Sub
    End If

add after this??
Code: (Find (frmMainMenu.Sub Status_Timer)) [Select]
        lblOnline.Caption = "Offline"
        lblOnline.ForeColor = vbRed
    End If
Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...