---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://yandex.com/dev/games/doc/en/sdk/defold/leaderboard.md
  - https://yandex.com/dev/games/doc/hi/sdk/defold/leaderboard.md
  - https://yandex.com/dev/games/doc/ko/sdk/defold/leaderboard.md
  - https://yandex.com/dev/games/doc/ru/sdk/defold/leaderboard.md
  - https://yandex.com/dev/games/doc/tr/sdk/defold/leaderboard.md
  - https://yandex.com/dev/games/doc/vi/sdk/defold/leaderboard.md
  - https://yandex.com/dev/games/doc/zh/sdk/defold/leaderboard.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/hi/llms.txt

# लीडरबोर्ड

आप किसी गेम पेज पर वैयक्तीकृत लीडरबोर्ड प्रदर्शित कर सकते हैं जिसमें शीर्ष प्लेयर के परिणामों और रैंकिंग में किसी लॉग-इन किए हुए उपयोगकर्ता का स्थान दिखाया गया हो।

नीचे दिए गए अनुरोधों के काम करने के लिए, सुनिश्चित करें कि:
* आपने [SDK को चालू और कॉन्फ़िगर कर दिया](https://yandex.com/dev/games/doc/hi/sdk/sdk-about.md#use) है, और उसका ऑब्जेक्ट `ysdk` वैरिएबल के माध्यम से उपलब्ध है।
* आपने डेवलपर डैशबोर्ड में एक लीडरबोर्ड [बना दिया](https://yandex.com/dev/games/doc/hi/concepts/leaderboards.md) है।

{% note alert "चेतावनी" %}

यदि डेवलपर डैशबोर्ड में **Technical leaderboard name** फ़ील्ड में कोई भी लीडरबोर्ड उसके नाम के साथ नहीं है, तो अनुरोध पर एक 404 त्रुटि आती है।

{% endnote %}

## लीडरबोर्ड का वर्णन

नाम द्वारा किसी लीडरबोर्ड का वर्णन पाने के लिए, `ysdk.leaderboards.get_description()` का उपयोग करें:

```lua
ysdk.leaderboards.get_description(
    leaderboard_name: string,
    callback: function
)
```

`callback: function` — कॉल की गई विधि का हैंडलर। इसका स्वरूप इस प्रकार है:

```lua
function(self, description: table|nil): nil
```

- `description: table` — लीडरबोर्ड का विवरण। इसमें निम्नलिखित गुण होते हैं:

```lua
description: {
  app_id: string,
  dеfault: boolean,
  invert_sort_order: boolean,
  decimal_offset: integer,
  type: string,
  name: string,
  title: {
    en: string,
    ru: string
  }
}
```

**उदाहरण**

```lua
function display_leaderboard()
  ysdk.leaderboards.get_description("highscores",
    function (self, description)
      if description then
        print(
          description.name,
          description.title.en
        )
    end
  end)
end
```

## नया स्कोर

{% note alert "प्रतिबंध" %}

केवल पंजीकृत उपयोगकर्ताओं के लिए अनुरोध उपलब्ध है। आवश्यकता होने पर [प्रमाणीकरण](https://yandex.com/dev/games/doc/hi/sdk/sdk-player.md#auth) का उपयोग करें।

{% endnote %}

खिलाड़ी के लिए नया परिणाम सेट करने के लिए, `ysdk.leaderboards.set_score()` मेथड का उपयोग करें:

```lua
ysdk.leaderboards.set_score(
    leaderboard_name: string,
    score: integer,
    extraData: string|nil
)
```

{% note info "नोट" %}

अनुरोध एक सेकंड में एक बार से अधिक नहीं भेजा जा सकता है, अन्यथा यह त्रुटि के साथ अस्वीकार कर दिया जाएगा।

{% endnote %}

## कोई रैंकिंग प्राप्त करना

{% note alert "प्रतिबंध" %}

केवल पंजीकृत उपयोगकर्ताओं के लिए अनुरोध उपलब्ध है। आवश्यकता होने पर [प्रमाणीकरण](https://yandex.com/dev/games/doc/hi/sdk/sdk-player.md#auth) का उपयोग करें।

{% endnote %}

उपयोगकर्ता की रैंकिंग प्राप्त करने के लिए, `ysdk.leaderboards.get_player_entry()` मेथड का उपयोग करें:

```lua
ysdk.leaderboards.get_player_entry(
    leaderboard_name: string,
    callback: function
)
```

`callback: function` — कॉल किए गए मेथड का हैंडलर। इसका स्वरूप है:

```lua
function(self, player_entry: table|nil): nil
```

- `player_entry: table` — उपयोगकर्ता रेटिंग। इसमें ये प्रॉपर्टीज़ शामिल हैं:

```lua
player_entry: {
  score: integer,
  extraData: string,
  rank: integer,
  avatar_src: {
    small: string,
    medium: string,
    large: string,
  },
  avatar_srcset: {
    small: string,
    medium: string,
    large: string,
  },
  lang: string,
  public_name: string,
  unique_id: string,
  formatted_score: string
}
```

**उदाहरण**

```lua
function display_high_score()
  ysdk.leaderboards.get_player_entry("highscores",
    function (self, player_entry)
      if player_entry then
        print("highscore: " .. player_entry.score)
      end
    end)
end
```

## लीडरबोर्ड प्रविष्टियाँ

उपयोगकर्ता रैंकिंग प्रदर्शित करने के लिए, `ysdk.leaderboards.get_entries()` का उपयोग करें:

```lua
ysdk.leaderboards.get_entries(
    leaderboardName: string,
    callback: function,
    options: {
        include_user: boolean|nil,
        quantity_around: number|nil,
        quantity_top: number|nil
    }
)
```

`callback: function`— कॉल किए गए मेथड का हैंडलर। इसका रूप है:

```lua
function(self, entries: table|nil): nil
```

`entries: table` — उपयोगकर्ताओं की रैंकिंग। इसमें निम्नलिखित गुण शामिल हैं:

```lua
entries: {
  leaderboard: {
    ...
  },
  ranges: [
    {
      start: integer,
      size: integer
    }
  ],
  userRank: integer,
  entries: [
    {
      score: integer,
      extraData: string,
      rank: integer,
      avatar_src: {
        small: string,
        medium: string,
        large: string,
      },
      avatar_srcset: {
        small: string,
        medium: string,
        large: string,
      },
      lang: string,
      public_name: string,
      unique_id: string,
      formatted_score: string
    },
    ...
  ]
}
```

---


<!-- source: hi/_includes/button-git-defold.md -->
<a href="https://github.com/yandex-games-plugins/defold">
  <span class="button">रिपोजिटरी</span>
</a>
<!-- endsource: hi/_includes/button-git-defold.md -->
