question

Kim Strasser avatar image
Kim Strasser asked

Is it possible to only get friends with certain Friend Tags when I call client API GetFriendsList?

I use various friend tags and I need to know if I can only get the friends in the player's friend list that don't have the friend tag "blocked". I don't need to get the blocked friends when I call client API GetFriendsList because I don't display the blocked friends in my game.

A player can block another player in my game if he doesn't want to get more friend requests from a certain player. I want to avoid that a certain player can send new friend requests to a player who has already rejected one or more friend requests from this certain player.

Is it possible to only get friends with certain Friend Tags when I call client API GetFriendsList?

In addition, is it possible that a player can not add a new friend to his friends list because he already has too much blocked friends in his friends list? What could I do in this case? I don't want that a player can not add new friends because he has many blocked friends in his friends list.

Friends
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

·
Xiao Zha avatar image
Xiao Zha answered

GetFriendsList can’t filter based on the tags, so that must be done locally. In addition, playfab does not clearly stipulate the limit on the number of friends.

If you are concerned about exceeding the limit of your friends list due to too many players being blocked, I think you can change the way to store blocked players. The workaround can be something like below:

1. Create blocked file for each player which contain players that blocked by them.

2. In Cloud Script, check the blocked file of the player you want to add before send new friend requests. If you are not in the file you can add the player as friend, otherwise cancel add friend operation.

3. For those players you have added but want to block, you can add them into the blocked file and just remove them without keeping them in the player list. In this case you don't need to use Block tag to differentiate players.

4 comments
10 |1200

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

Kim Strasser avatar image Kim Strasser commented ·

I don't know how to create a blocked file for each player. Where could I store the blocked players(PlayFabIds?) in the player's PlayFab account?

How can I get the content of this blocked file in CloudScript? Because I need to find out in CloudScript if the current player can send a friend request to a certain player. I need to find out if the current player is in the blocked file of the certain player.

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha Kim Strasser commented ·

Sorry for the confusion, the "file" I mentioned above is actually player data, it's not the entity file. So you can save the blocked players as Json format in player data use UpdateUserData API, then you can call GetUserData in cloudscript to get blocked players. Here the code example in cloud script:

handlers.GetUserData=function(args,context)
{
    var result = server.GetUserData({PlayFabId: args.id,Keys:args.key});
    var key=args.key;
    return JSON.parse(result.Data[key].Value);
0 Likes 0 ·
Kim Strasser avatar image Kim Strasser Xiao Zha commented ·

Is there a size limit for 1 single Player Data key/value pair?

Is the size of 300,000 bytes the total size limit for all Player Data key/value pairs or is it only the limit for 1 single key/value pair?

0 Likes 0 ·
Show more comments

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.