question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

How to use showing ban reason and duration feature in the game?

Hello,

I want to show ban reasons and durations to the players who are banned from the game. I found an option "Allow client to view ban reason and duration" under the Title Settings -> API Features, but I don't know where the data is stored in the game.

The code in the game is basically like this. Where can I find the data that shows the reason and duration?

    private void OnLoginFail(PlayFabError error)
    {
        if (error.Error == PlayFabErrorCode.AccountBanned)
        {
            // ... Show ban reason and duration
        }
    }
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

·
Sarah Zhang avatar image
Sarah Zhang answered

You can refer to the following code statement. Besides, you can consider using REST API testing tools, such as Postman to test all PlayFab API. If so you can check all responses of API methods, then find the location of the data you want. You can find our Postman SDK here -- https://docs.microsoft.com/en-us/gaming/playfab/sdks/postman/.

 private void OnLoginFailure(PlayFabError error)
    {
        if (error.Error == PlayFabErrorCode.AccountBanned)
        {
            foreach (var item in error.ErrorDetails)
            {
                Debug.Log("Reason : " + item.Key + "\t" + "Expires : " + item.Value[0]);
            }
        }
       
    }
1 comment
10 |1200

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

electricytart avatar image electricytart commented ·

Is there a way to show how many hours are left before the player is unbanned?

0 Likes 0 ·

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.