![]() |
Player/Friend list - Printable Version +- Mirage Source (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: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: Player/Friend list (/showthread.php?tid=950) |
Player/Friend list - smchronos - 24-05-2007 Difficulty: (I have no clue) This is my own method of doing the following. I've checked and haven't found a tutorial already on this, so I'm posting my way, whether it is the most efficient or not. If the moderators of this community wish to remove this tutorial on the premises that there is already a better (or similiar) tutorial, I have no complaints. Adding a player list and/or friend list [client-side] Control Requirements: CommandButton Controls (2) Listbox Controls (2) Frame Control (1) OptionButton Controls (2) Label (1) -Open up frmMirage and add the following controls: CommandButton Controls (2) -cmdAdd -cmdRemove Listbox Controls (2) -lstPlayers -lstFriends Frame Control (1) -Any Name OptionButton Controls (2) -optPlayers -optFriends Label (1) -lblPNumber -Open up frmMirage's code and add the following: Code: Private Sub cmdAdd_Click() -Open up Constants.bas and add: Code: 'Constant for Player Friends -Open up Types.bas and find Type PlayerRec -At the end of this type, before closing it with End Type, add: Code: 'Friends -Open up HandleData.bas and add: Code: Dim p as Integer Code: ' ::::::::::::::::::::::: -Lastly, add this to nearly any module. I placed my in the GameLogic near the bottom: Code: Function IsFriend(ByVal Index As Long, ByVal Name As String) As Boolean [server-side] -Open up Constants.bas and add: Code: 'Constant for Player Friends -Open up Types.bas find Type PlayerRec and add within: Code: 'Friends -Open up HandleData.bas and add within the HandleData subroutine Code: ' :::::::::::::::::::::::::: -Open up GameLogic.bas and find the JoinGame subroutine and add with the other sendblah subroutines: Code: Call SendFriends(Index) -This can be placed in nearly any module, but I prefered adding it in the ServerTCP: Code: Sub SendFriends(ByVal Index As Long) (This is only needed if you are still using .ini files to save account data. Binary methods will need to be deleted and remade, but no extra code is necessary) -Open up Database.bas and find the SavePlayer subroutine. It doesn't matter where in here you add the following, but I placed it under the position putvars Code: 'Set Friends Code: 'Get Friends -Still within Database.bas, find the ClearPlayer subroutine and add anywhere: Code: For n = 1 To MAX_FRIENDS I cut this out of my own server/client, so I may have forgotten something. If you get an error, please post it here. - William - 24-05-2007 We aint removing it, well done. - Braydok - 24-05-2007 Indeed, I was wondering if there was one on here, but hadn't really looked. I'll have to include this in my client. - William - 24-05-2007 Braydok Wrote:Indeed, I was wondering if there was one on here, but hadn't really looked. I'll have to include this in my client.I think there are a online list somewere but it doesnt hurt to have a new one. The friend list doesnt exist thought. Re: Player/Friend list - Sh4d0ws - 23-08-2007 If someone could, i tried to use this Tutorial and it did not work. When i tried to add the fallowing to the Type.bas file, it gave me an error on both the client and the server. 'Friends Friend(1 To MAX_FRIENDS) As String --- The error message was this: Compile Error: Only valid in object module I believe that i fallowed the tutorial completely, and i am unsure as to why i am getting this error. Re: Player/Friend list - smchronos - 28-08-2007 Make sure that the constant is defined and you've placed this inside the PlayerRec type block in the types.bas Also, recheck the steps to see if you skipped one. Re: Player/Friend list - Sh4d0ws - 29-08-2007 I just re-did the entire tutorial. No change. As far as i can tell, i did everything like you recommended. I'll talk to you on MSN/AIM whenever your online hopefully and we can get this fixed. Re: Player/Friend list - Matt2 - 11-12-2007 Hey, I might upload mine pretty soon. It adds/deletes players, shows if they're offline or not, and allows them to communicate. Also, when you delete a player, both parties are removed from each other's list. I just ran down this code, and looks like alot for nothing. then again, mine only sends raw text back and forth... Anyways, kudos on this. |