Skip to main content

Player rating

Get player rating

+1 Request
info

Use fetchPlayerRating to get the player's position in the rating.

You can get the rating position of a player through fetchPlayerRating. This is a crippled version of fetch for the player.

const result = await ss.leaderboard.fetchPlayerRating({
// Sorting by fields from left to right
orderBy: ['level', 'gold'],
// DESC sorting – big values first, ASC sorting – small values first
order: 'DESC',
// Include the field list to display in the leaderboard, in addition to orderBy
includeFields: ['rank'],
// Get N nearest players above and below, maximum 10
showNearest: 5
})

// Response result
const { player, fields, abovePlayers, belowPlayers } = result
// Player position
player.position
// Player name
player.name
// Player avatar
player.avatar
// Player variables
player.level
player.gold
player.myVariable

Response:

PropertyTypeDescription
playerLeaderboardPlayerdata of my player with position
abovePlayersLeaderboardPlayer[]list of players above my player
belowPlayersLeaderboardPlayer[]list of players below my player

Get player scoped rating

+1 Request

You can get the rating position of a player through fetchPlayerRatingScoped. This is a crippled version of fetchScoped for the player.

const result = await ss.leaderboard.fetchPlayerRatingScoped({
// leaderboard ID
id: 17,
// leaderboard Tag
tag: 'LEVELS',
// Scope name
variant: 'level_15',
// Add list of player fields to display in table, in addition to table fields
includeFields: ['rank'],
// Get N nearest players above and below, maximum 10
showNearest: 5
})

// Result
const { player, fields, abovePlayers, belowPlayers } = result
// Player position
player.position
// Player name
player.name
// Player avatar
player.avatar
// Player variables
player.level
player.gold
player.myVariable

Response:

PropertyTypeDescription
playerLeaderboardPlayerdata of my player with position
abovePlayersLeaderboardPlayer[]list of players above my player
belowPlayersLeaderboardPlayer[]list of players below my player

Stay in Touch

Other documents of this chapter available Here. To get started, welcome to the Tutorials chapter.

SpellSync Community Telegram: @spellsync.

For your suggestions e-mail: [email protected]

We Wish you Success!