Leaderboards
You can display personalized leaderboards with the best players' results and the user's place in the ranking on the game page.
To make the requests described below work, make sure that a leaderboard has been created in the developer console.
Submitting a score
The request is available only to authorized users. It is recommended to use authorization in advance and use leaderboards only if the user has provided personal data.

Use the action to submit a new score to the leaderboard with the
following parameters:
Name | string | The technical name of the leaderboard. |
Score | number | The player's score in the leaderboard. |
Additional data | string | Optional metadata sent along with the score. |
For example, submitting a score to the leaderboard might look like this:
The request can be sent no more than once per second. Otherwise, it will be rejected with an error.
It is recommended to use the score submission with a special condition .

Leaderboard entries
To display the user rating, use the loop with the following
parameters:
Name | string | The technical name of the leaderboard. |
Top positions | number | The number of entries requested from the leaderboard's top. |
Request player position | boolean | Determines whether the user's position will be requested. |
Positions around the player's position | number | The number of entries requested below and above the user in the leaderboard. |
The plugin will request leaderboard data from the Yandex.Games SDK, after which the loop will start. This process takes some time.
It is recommended to leave some kind of loading indicator on the screen while this process is happening.
Make sure that this loop is not called constantly. It is recommended to use it inside functions or triggers.
Inside the loop, you will have access to expressions from the lists: Player and Leaderboards.


Example of a leaderboard
Below you can see and download an example of a leaderboard display.
The example includes:
- A loading wheel before displaying the leaderboard.
- Displaying the score and name.
- Displaying player avatars.
- Displaying the player's place in the leaderboard.
The example uses Text localization, Sprite localization, and the Adaptive text plugin.
