terabin Posted January 8, 2013 Author Share Posted January 8, 2013 Hello,anyone can help-me? I having problems with my friend list…This code send the friend list...```For i = 1 To MAX_FRIENDSFor i4 = 1 To MAX_PLAYERS '''''''If GetPlayerName(i4) = Player(index).Friends(i).FriendName And Not Player(index).Friends(i).FriendName = vbNullString ThenCall SendDataTo(index, SUpdateFriendList & SEP_CHAR & Player(index).Friends(i).FriendName & SEP_CHAR & "(Online)" & END_CHAR)End IfNextNextFor i = 1 To MAX_FRIENDSFor i4 = 1 To MAX_PLAYERSIf Not GetPlayerName(i4) = Player(index).Friends(i).FriendName ThenCall SendDataTo(index, SUpdateFriendList & SEP_CHAR & Player(index).Friends(i).FriendName & SEP_CHAR & END_CHAR)End IfExit ForNextNext```And this is my problem: ![](http://img4.imageshack.us/img4/3050/76181637.png) Link to comment Share on other sites More sharing options...
Growlith1223 Posted January 8, 2013 Share Posted January 8, 2013 lol you have it going twice. Need to make it CHECK if the player is online.My way of doing it would be adding a new piece in the PlayerRec Called```Online As Byte```Send that to all players that are friends with you.thenReplace your code with```For i = 1 to MAX_PLAYERSIf Player(I).Online = 1 Then' Send update for the person is onlineElse'Send update for the person is offlineEnd If```idk though, that's just me xDIm not exactly sure. plus the fact i haven't used EE for so long :/(from the network code you posted it looks like EE) Link to comment Share on other sites More sharing options...
terabin Posted January 8, 2013 Author Share Posted January 8, 2013 Ok,a changed to this:``` For i = 1 To MAX_FRIENDS For i4 = 1 To MAX_PLAYERS ''''''' Player(index).Friends(i).Online = 0 If GetPlayerName(i4) = Player(index).Friends(i).FriendName And IsPlaying(i4) And Not Player(index).Friends(i).FriendName = vbNullString Then Player(index).Friends(i).Online = 1 Else Player(index).Friends(i).Online = 0 End If If Player(index).Friends(i).Online = 1 Then Call SendDataTo(index, SUpdateFriendList & SEP_CHAR & Player(index).Friends(i).FriendName & SEP_CHAR & "(Online)" & END_CHAR) Else Call SendDataTo(index, SUpdateFriendList & SEP_CHAR & Player(index).Friends(i).FriendName & SEP_CHAR & vbNullString & END_CHAR) End If Exit For NextNext```And the problem:![](http://img32.imageshack.us/img32/2158/92136368.png) Link to comment Share on other sites More sharing options...
Growlith1223 Posted January 8, 2013 Share Posted January 8, 2013 do you have it where it's sending that the player is offline? Link to comment Share on other sites More sharing options...
terabin Posted January 8, 2013 Author Share Posted January 8, 2013 Here…?``` If Player(index).Friends(i).Online = 1 Then Call SendDataTo(index, SUpdateFriendList & SEP_CHAR & Player(index).Friends(i).FriendName & SEP_CHAR & "(Online)" & END_CHAR) Else Call SendDataTo(index, SUpdateFriendList & SEP_CHAR & Player(index).Friends(i).FriendName & SEP_CHAR & vbNullString & END_CHAR) End If``` Link to comment Share on other sites More sharing options...
Growlith1223 Posted January 8, 2013 Share Posted January 8, 2013 When the player logs out, you should send out that he is offline making that variable to 0 THEN, send a new packet to the clients with that variable, then refreshing the list, and it should work. Link to comment Share on other sites More sharing options...
terabin Posted January 8, 2013 Author Share Posted January 8, 2013 This already exist here…and the problem continue...``` If GetPlayerName(i4) = Player(index).Friends(i).FriendName And IsPlaying(i4) Then Player(index).Friends(i).Online = 1 Else Player(index).Friends(i).Online = 0 End If``` Link to comment Share on other sites More sharing options...
Growlith1223 Posted January 8, 2013 Share Posted January 8, 2013 Do you have it updating when the player joins?Also try taking out the line that sets the Online to 0 at the beginning. that may be part of the problem :/ Link to comment Share on other sites More sharing options...
terabin Posted January 8, 2013 Author Share Posted January 8, 2013 I resolved using this:```Dim TempStr As StringDim TempIndex As IntegerFor i = 1 To MAX_FRIENDS 'Percorre a lista de amigos If Player(Index).Friends(i).FriendName <> vbNullString Then ' Se não houver nulos TempStr = Player(Index).Friends(i).FriendName For n = 1 To MAX_PLAYER 'Percorre a lista de jogadores online If IsPlaying(n) Then If GetPlayerName(n) = TempStr Then 'Se achar o nome pegar o Index TempIndex = n Exit For ' Quebrar o loop End if End if Next If TempIndex > 0 Then 'Se encontrar jogador online enviar Call SendDataTo(index, SUpdateFriendList & SEP_CHAR & Player(index).Friends(i).FriendName & SEP_CHAR & "(Online)" & END_CHAR) Else 'Se não encontrar jogador online enviar Call SendDataTo(index, SUpdateFriendList & SEP_CHAR & Player(index).Friends(i).FriendName & SEP_CHAR & END_CHAR) End If Else 'Se houver nulo, enviar free slot Call SendDataTo(index, SUpdateFriendList & SEP_CHAR & "Free Slot" & SEP_CHAR & END_CHAR) End IfTempIndex = 0 'Zerar TempIndex para proxima procuraNext```The problem is the exit for. Link to comment Share on other sites More sharing options...
JohnPony Posted January 8, 2013 Share Posted January 8, 2013 Why are you using string based packets? Link to comment Share on other sites More sharing options...
Exception Posted January 8, 2013 Share Posted January 8, 2013 > Why are you using string based packets?EE/ES. Probably. Link to comment Share on other sites More sharing options...
JohnPony Posted January 10, 2013 Share Posted January 10, 2013 Looks like GIAKEN's bomberman online thing or whatever he released IMO. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now