Print Page | Close Window

Online List

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=126
Printed Date: 20 December 2006 at 5:52pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Online List
Posted By: Sync
Subject: Online List
Date Posted: 11 February 2006 at 2:38pm
Author: Asrrin29


Server side
Go to modServerTCP
Find

Sub SendWhosOnline

add this code underneath:

Sub SendOnlineList(ByVal index As Long)
Dim packet As String
Dim i As Long
Dim n As Long
packet = ""
n = 0
For i = 1 To MAX_PLAYERS
If IsPlaying(i) Then
packet = packet & SEP_CHAR & GetPlayerName(i) & SEP_CHAR
n = n + 1
End If
Next i

packet = "ONLINELIST" & SEP_CHAR & n & packet & END_CHAR

Call SendDataToAll(packet)
End Sub


Find
Sub HandleData

Find
Whos Online Packet

add this code underneath:

' :::::::::::::::::::::::
' :: Online list ::
' :::::::::::::::::::::::
If LCase(Parse(0)) = "onlinelist" Then
'Stop
Call SendOnlineList(index)
Exit Sub
End If

Find
Sub JoinGame

after this code:

Call SendTimeTo(index)

add this code underneath:

Call SendOnlineList(index)

Find
Sub LeftGame

After this code:

Call ClearPlayer(index)

Add this code underneath:

Call SendOnlineList(index)

Finished Server side.

Open Client.
Go to modClientTCP
Find
Sub SendWhosOnline

Add this code underneath it:

Sub SendOnlineList()
Dim packet As String

packet = "ONLINELIST" & SEP_CHAR & END_CHAR
Call SendData(packet)
End Sub


Go to
Sub HandleData

Scroll to the bottom of the handle data sub and add this at the end:

' ::::::::::::::::::::::::::
' :: Get Online List ::
' ::::::::::::::::::::::::::
If LCase(Parse(0)) = "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

Now open up frm mirage, add a listbox and name it lstOnline, and set it's visibilty to false. add a picbox named picOnline with visiblity set to true and another named picOffline with visibilty set to false. finally add a label named label9 and set it's cation to "Who Is Online." now view the source and add this code:

Private Sub picOffline_Click()
Call SendOnlineList
lstOnline.Visible = False
picOffline.Visible = False
picOnline.Visible = True
Label9.Visible = False

End Sub

Private Sub picOnline_Click()
Call SendOnlineList
lstOnline.Visible = True
picOffline.Visible = True
picOnline.Visible = False
Label9.Visible = True

End Sub




Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info