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?
Answer by Sarah Zhang · 2 days ago
>> 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.
Is it possible to create a leaderboard in Azure Functions at a given time?
For example: I want to create a tournament that lasts 1 week and starts on Monday, January 18, 2021 at 00:00 and ends on Sunday, January 24, 2021.
I want to use Scheduled Tasks to execute an Azure function that creates a leaderboard with admin API CreatePlayerStatisticDefinition. I have already created the Azure function but I don't know how to use Scheduled Tasks so that the Azure function gets called at the correct date and time.
How can I use Scheduled Tasks so that the leaderboard starts on Monday, January 18, 2021 at 00:00? What Cron expression should I use for the date and time?