How to find a friends ?
I have no idea how to use method
instance:findFriends (friendsToFind)
Requests Master server for actors online status and joined rooms.
Override onFindFriendsResult to handle request results.
Parameters:
friendsToFind: table Actors names array.
How can i get the actor's names ? or friends names
How can i set names of the actor ?
instance:setName(name) method doesn't working for me so far.
Please help me....
Thank you in advance.
Bhavin
instance:findFriends (friendsToFind)
Requests Master server for actors online status and joined rooms.
Override onFindFriendsResult to handle request results.
Parameters:
friendsToFind: table Actors names array.
How can i get the actor's names ? or friends names
How can i set names of the actor ?
instance:setName(name) method doesn't working for me so far.
Please help me....
Thank you in advance.
Bhavin

0
Answers
-
While joined to a master server (but not in room yet), call client:findFriends({"name1", "name2" ... }) with array of names of friends as parameter.
Override onFindFriendsResult in your client. As soon as server replies, this method will be called with requested friends infos as parameter:function client:onFindFriendsResult(errorCode, errorMsg, friends) client.logger:info("onFindFriendsResult",errorCode, errorMsg, friends) if friends then for k, v in pairs(friends) do client.logger:info(" ", k, v.online, v.roomId) end end end
0 -
Thanks for the reply..
Yes, i just got working findFriends method and getting response in onFindFriendsResult(...) also.
I am just worried now that i am not getting roomId for the Actor.
And always getting online == false , even when i that particular friend(actor) joined room already.
Thanks.
Bhavin
0 -
You can't be in a room and in a lobby at the same time. As I wrote, client:findFriends should be called from lobby. So you need 2nd client joined to a room to check friends and find at least one of them playing. Or you can probably check your own status which will be online but not joined to any room.0
-
Here is the process what i did:
1. connect one player to the lobby and set a name --> "player1"
2. connect 2nd player to the lobby and set a name --> "player2"
3. now call findFriends({"player1"}) from player2's deviceand got result :
playerName == player1
roomId == "" or nil
online == false
4. now create room from player1 and set name "room1"
5. now call findFriends({"player1"}) method once again and see the same result as step 3..
Now what is wrong here ?
I can't get player correct status and room Id ...
Please help me.
Actually i want functionality like this:
When player comes up and joined to the lobby, he wants to join a room in which his friend is joined.
So finding friends with name and get room name (roomId) , so we can then join that room.
What should i do here ?
Thank you.
Bhavin0 -
Hi Vadim,
Is there anything wrong with my code ?
Please help me.
I can't move on without findFriends method working..
Thank you.
Bhavin0 -
1. It loos like you set name after joining a lobby. Set it before connection.
2. client:setUserId("player1") method should be used. Friends are searched by userId's in fact. not by player name set via client:myActor():setName.
There is some mess with ids and names in Photon currently. Sorry for that. We will sort it out.0 -
Hi Vadim,
Thanks For the reply.
I just test with setUserId and then try findFriends() method and it's working now.
now i have just one question :smile :
I can client:setUserId(userId) just after client instance created ?
so will be like this :local client = LoadBalancingClient.new(appInfo.MasterAddress, appInfo.AppId, appInfo.AppVersion) client:setUserId(userId)
is that looks okay or i need to set it after join Lobby ?
Thank you so much for the solution Man...
Bhavin
0 -
Set it before connecting to Photon.
Right after client instance creation is perfect.0