Online User List
From VbGORE Visual Basic Online RPG Engine
Example of Online User Window:
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: <ini> Private Sub Shutdown_Click() </ini>
Below Add:
<ini>
UnloadServer = 1 </ini> This will shutdown the server when the cammand button "Shutdown" is pressed.
Find/Locate:
<ini>
Private Sub Form_Load()
Dim TempSplit() As String
</ini>
Below Add: <ini> frmOnline.Show
Server_RefreshUserListBox
</ini> 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()
<ini>
'Show status
Server_RefreshUserListBox
</ini> This will refresh the User list box.
In General.bas add:
<ini> 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 </ini> This will refresh the User list box and shows current connections.
Find/Locate:
<ini>
'Update number of users If NumUsers <> 0 Then NumUsers = NumUsers - 1 TrayModify ToolTip, Server_BuildToolTipString
</ini>
Below add: <ini>
Server_RefreshUserListBox
</ini> This will refresh the User list box when the number of users changes.
Find/Locate: <ini>
'Update number of users NumUsers = NumUsers + 1
</ini>
Below add:
<ini>
'Refresh list box and send log on string Server_RefreshUserListBox
</ini> 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.