question

wowbigmac avatar image
wowbigmac asked

SetFriendTags works for one player but not the other.

Greetings, i have been trying to setFriendTags for both the currentplayer and the friend.

var secoundFriendTag = {}; secoundFriendTag.FriendPlayFabId = (args.FPFI == undefined || args.FPFI == null ) ? "" : args.FPFI;

secoundFriendTag.PlayFabId = (args.Iddd == undefined || args.Iddd == null) ? "" : args.Iddd;

secoundFriendTag.Tags = ["requester"]; var friendTag = {}; friendTag.FriendPlayFabId = (args.sender == undefined || args.sender == null) ? "" : args.sender;

friendTag.PlayFabId = (args.reciever == undefined || args.reciever == null) ? "" : args.reciever;

friendTag.Tags = ["requestee"];

server.SetFriendTags(secoundFriendTag);

server.SetFriendTags(friendTag);

As you can see i have set up the currentplayerID over at unity but i have also tried to use cloudscript's currentplayerID and the result i am getting is as follows:

The requester tag is appears to the user but the requestee tag is not showing ? i was wondering if anyone could shed some light for this issue

unity3dCloudScript
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

·
brendan avatar image
brendan answered

Something would have to be wrong with the parameters being passed in, then. Can you try a) logging the value of the "friendTag" and "secoundFriendTag" before each SetFriendTags call, b) putting a try/catch on your server API calls, to catch any errors, and c) logging any error responses to the SetFriendTags calls?

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.

wowbigmac avatar image wowbigmac commented ·
        PlayFabClientAPI.GetAccountInfo(request2,
            result =>
            {
                FriendPlayfabID = result.AccountInfo.PlayFabId;
                ExecuteCloudScriptRequest request = new ExecuteCloudScriptRequest();
                request.FunctionName = "AddFriend";
                request.SpecificRevision = 47;
                request.FunctionParameter = new { Iddd = GoogleSignIn.myPlayFabID, sender = FriendPlayfabID, reciever = GoogleSignIn.myPlayFabID,FPFI = FriendPlayfabID };
                PlayFabClientAPI.ExecuteCloudScript(request, FriendResult, DisplayPlayFabError);


            },
            error =>
            {


                debugText.text = "An error has occured:   " + error.GenerateErrorReport();


            });


I apologise for posting a piece of code but am i doing something wrong here ?
0 Likes 0 ·
brendan avatar image brendan wowbigmac commented ·

The code you've provided is showing that you're calling a Cloud Script handler named "AddFriend". Unfortunately, that doesn't tell me what is in the values you're passing into the call to SetFriendTags, or the response data. Can you try adding the log.info lines I recommended above?

0 Likes 0 ·
wowbigmac avatar image wowbigmac brendan commented ·

I have successfully fixed my error but in a weird way.

as you can see i have switched the two ID's at the end of each call. I'm not sure why that worked for me.

 var secoundFriendTag = {};

  secoundFriendTag.FriendPlayFabId = (args.FPFI == undefined || args.FPFI == null ) ? "" : args.Iddd;

  secoundFriendTag.PlayFabId = (args.Iddd == undefined || args.Iddd == null) ? "" : args.FPFI;

  secoundFriendTag.Tags = ["requester"];

  }

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.