![]() |
MS4 - Byte Array Packets [Incomplete] - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: MS4 - Byte Array Packets [Incomplete] (/showthread.php?tid=3259) |
MS4 - Byte Array Packets [Incomplete] - Jacob - 28-10-2009 This is not complete. I need to save what I've written so far. Packets In modEnumerations ENUM ServerPackets- Are for packets going from Server -> Client. ENUM ClientPackets- Are for packets going from Client -> Server. * MAKE SURE THE ENUMS ARE EXACTLY THE SAME BOTH SERVER AND CLIENT SIDE!!!! modHandleData Sub InitMessages Add your packet like the others. Example: Code: HandleDataSub(CMsgPlayerRevival) = GetAddress(AddressOf HandlePlayerRevival) HandleDataSub() is an array that will hold the memory address of a sub that deals with that packet. The following sub is how all the HandleData subs HAVE TO BE! Code: Private Sub Handle*(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Writing a packet Example: Code: Sub SendPlayerInfoRequest(ByVal Name As String) When handling the data on the other end, you need to make sure to take the data out in the same order you put it in. The packet header does not count because it automatically gets taken care of. Example: Code: Private Sub HandlePlayerInfoRequest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Re: MS4 - Byte Array Packets [Incomplete] - GIAKEN - 28-10-2009 Aren't byte array packets already in the engine? ![]() Re: MS4 - Byte Array Packets [Incomplete] - Jacob - 28-10-2009 Yes, this is showing how to use them. Re: MS4 - Byte Array Packets [Incomplete] - GIAKEN - 28-10-2009 Don't you need to Set Buffer = Nothing when finished to prevent memory leaks? |