question

aleksanderstanoch avatar image
aleksanderstanoch asked

Reward for leaderboards based on ranking

Hi, I want to give rewards to players on the leaderboard based on their ranking. Rewards items are stored as JSON in player title data. The leaderboard resets once per week. When a player will log in, he has to see a pop-up with rewards and the place that he achieved. I tried to use the price table to run the cloud script, but how can I receive the player rank of this leaderboard? How should I implement the whole system?

Player DataLeaderboards and Statistics
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

·
Simon Cui avatar image
Simon Cui answered

If you want to get weekly resettable leaderboard data of previous version, you can refer to Accessing archived tournament results, where you can Accessing archived data using Game Manager, or Accessing archived data using API. In the client side, you may call GetLeaderboard Client API and specify the previous version of the leaderboard you want to load. The example code is as shown below:

 PlayFabClientAPI.GetLeaderboard(new GetLeaderboardRequest()
 {
     StatisticName = "TestScore",
     Version = 1
 }, result =>
 {
     Debug.Log("Leaderboard version: "+result.Version);
    
     foreach (var entry in result.Leaderboard)
     {
         Debug.Log(entry.PlayFabId+" "+entry.StatValue);
     }
 }, FailureCallback);
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.