question

maximelaffaire avatar image
maximelaffaire asked

server AddFriend function problem

Hi,

I am currently implementing a friends list system that requires both of the players to invite each other as friend. I'm using the user data for that, stocking the PlayFabID of player A into user data of player B, and when player B checks his friends request I look into his user data to see that player A sent an invitation.

That part is working well, but I have a problem with the addFriend function : on cloudscript, when I call server.addFriend(playerA, playerB) it works but then I call server.addFriend(playerB, playerA) and it throws an "UsersAlreadyFriends" error.

Is that behaviour normal or is it a bug ? I'm not really sure because the API doc says that addFriend "Adds the Friend user to the friendlist of the user with PlayFabId.", so it supposes to add a friend in only one way.

Sorry if you already reply to that problem, I didn't find anything about it.

apis
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
maximelaffaire avatar image
maximelaffaire answered

My bad, I actually was removing player B from player A's friend list but not player A from player B's friend list ... So it was normal that Playfab was throwing that error ...

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.