Online User List

From VbGORE Visual Basic Online RPG Engine

Example of Online User Window:

Online.png

Note:This tutorial dosn't include the uptime timer, for a tutorial on that please refer to http://www.vbgore.com/Server_Uptime_Timer.


Make a new form, frmOnline This is the window that will show the online users. Add a listbox called Userslst This is where the online users will be displayed. Make a Command button called Shutdown This will shutdown the server.

Find/Locate:

Private Sub Shutdown_Click()

Below Add:

UnloadServer = 1

This will shutdown the server when the cammand button "Shutdown" is pressed.


Find/Locate:

Private Sub Form_Load()
Dim TempSplit() As String

Below Add:

frmOnline.Show
    Server_RefreshUserListBox

This will display your online user window when the server starts up.


Doubble click on the frmOnline window and add the following into Private Sub Form_Load()

'Show status
 Server_RefreshUserListBox

This will refresh the User list box.


In General.bas add:

Sub Server_RefreshUserListBox()
 
'*****************************************************************
'Refreshes the User list box
'*****************************************************************
 
Dim LoopC As Long
 
    If LastUser < 0 Then
        frmOnline.Userslst.Clear
        Exit Sub
    End If
 
    frmOnline.Userslst.Clear
    CurrConnections = 0
    For LoopC = 1 To LastUser
        If UserList(LoopC).Name <> "" Then
            frmOnline.Userslst.AddItem UserList(LoopC).Name
            CurrConnections = CurrConnections + 1
        End If
    Next LoopC
    TrayModify ToolTip, "Game Server: " & CurrConnections & " connections"
 
End Sub

This will refresh the User list box and shows current connections.


Find/Locate:

    'Update number of users
    If NumUsers <> 0 Then NumUsers = NumUsers - 1
    TrayModify ToolTip, Server_BuildToolTipString

Below add:

    Server_RefreshUserListBox

This will refresh the User list box when the number of users changes.

Find/Locate:

    'Update number of users
    NumUsers = NumUsers + 1


Below add:

   'Refresh list box and send log on string
    Server_RefreshUserListBox

This will refresh the User list box.

Once that is added, when you run the server, frmOnline should show up and all the online players should be shown in the listbox. You can also add a fancy background to thet form or the list box to make lit look better.

Personal tools