question

Kim Strasser avatar image
Kim Strasser asked

How can I find out which leaderboards are currently active?

For example:

I have 10 levels in my game and I have one leaderboard for each of these 10 levels in my titles account. Reset frequency is manually. Now I want to create weekly tournaments/leaderboards for only 3 of these 10 levels so that the players can add their scores on those 3 active leaderboards. When the next leaderboard reset happens on these 3 leaderboards, then it shouldn't be possible for the players to add their score on these leaderboards. I want to change the active leaderboards every week. It should only be possible to add a score on an active leaderboard. Leaderboards should be active for one week, after that, they should be disabled until the next tournament starts.

In addition, I need to find out in the client or CloudScript which leaderboards are currently active and which leaderboards are not active. Because I need to know if the player can add his score to a certain leaderboard or not.

How can I find out in the client which leaderboards are currently active? Is it possible to use client API GetLeaderboard to get a list with the active leaderboards?

Leaderboards 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

·
Sarah Zhang avatar image
Sarah Zhang answered

>> How can I find out in the client which leaderboards are currently active? Is it possible to use client API GetLeaderboard to get a list with the active leaderboards?

PlayFab Leaderboard doesn’t have the states like “active”, so you can’t use client API to get the leaderboard list you specified. Besides, for clarification, the API GetLeaderboard is designed to retrieve a list of ranked users for the given statistic, it can’t be used to get the leaderboard list.

You can use the CloudScript and TitleData to achieve the feature. You can store the active leaderboard’s name in the TitleData and let players only can update the statistics via CloudScript. To forbid the players to upload the statistics via Client API, please navigate to [Game Manager]->[Title Settings]->[API Features], uncheck the option [Allow clients to post player statistics]. The CloudScript function can find out the active Leaderboard via getting TitleData, and post the player statistics via calling server API UpdatePlayerStatistics.

In addition, if your active leaderboard is changed regularly, you can consider using Schedule Task to trigger a CloudScript Function to change the corresponding TitleData.

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.

Kim Strasser avatar image Kim Strasser commented ·

Thanx. It works now. I use Scheduled Tasks to trigger a CloudScript function to change the TitleData.

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.