question

Kim Strasser avatar image
Kim Strasser asked

How can I find out if a friend request already exists?

https://community.playfab.com/questions/61827/how-can-i-create-a-close-friends-system-with-playf.html?childToView=61885#comment-61885

I want to create a close friends system where you need to send a friend request to a player in order to get close friends. It is necessary that player B is already in player A's friends list before player A can send a close friend request to player B in my game's friend list menu. I use PlayFabClientAPI.AddFriend in my game to add a friend.

I found the following CloudScript code example from Rick Chen: https://community.playfab.com/questions/46961/add-friend-using-friend-request-with-acceptdecline.html

I don't want that player A can send multiple close friend requests to player B. It should only be possible for player A and player B to send a new close friends request if player B has accepted or declined the first close friends request. How can I find out if a close friend request already exists?

CloudScriptFriends
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

·
Gosen Gao avatar image
Gosen Gao answered

If you implement your close friends service with Rick's workflow that player A sends a close friend request to player B, there will be a tag in the friend list, such as “WantToBeCloseFriend”/"WaitToBeAccepted". Then, you can know if a close friend request already exists by checking the tag.

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.