The function will return leaderboard information for the given user name. The leaderboard must have been created previously on the XDP dashboard for your game, and callin the function will trigger a callback Social Asynchronous Event which contains the async_load map populated with the relevant key/value pairs. The "id" key of this DS map is used to identify the correct callback (there can be more than one trigger function for any given asynchronous event), and IT will be paired with the constant achievement_leaderboard_info as well as a number of other key/value pairs. The exact contents of the map are shown below:
- "id" - For this function it should be achievement_leaderboard_info
- "leaderboardid" - The unique ID for the leaderboard as defined on the provider dashboard.
- "numentries" - The number of entries in the leaderboard that you have received.
- "PlayerN" - The name of the player, where "N" is an integer value corresponding to their position within the leaderboard entries list.
- "PlayeridN" - The unique user id of the player, "N".
- "RankN" - The rank of the player "N" within the leaderboard.
- "ScoreN" - The score of the player "N".
The function requires you to give one of the following constants to set the filter properties:
Constant Description achievement_filter_all_players Get all scores. achievement_filter_friends_only Get only friends scores, in ascending order. achievement_filter_favorites_only Get only favorites scores, in ascending order achievement_filter_friends_alt Get only friends scores in descending order. achievement_filter_favorites_alt Get only favorites scores in descending order.
xboxlive_read_player_leaderboard(leaderboard_name, user_name, num_items, friend_filter);
Argument Description leaderboard_name The name of the leaderboard to read, as set up on XDP. user_name The name of the user to read from. num_items The number of items to retrieve. friend_filter One of the filter constants (see the description, above).
var _user = xboxlive_user_for_pad(0); var _uid = xboxlive_user_id_for_user(_user); xboxlive_read_player_leaderboard("MyLeaderboard", _uid, 10, achievement_filter_all_players);
The above code gets the user ID and then uses that to request all the player data for the first 10 places of the given leaderboard.