question

pietro martino avatar image
pietro martino asked

How to get player location from "get leaderboard" node in UE4?

6204-lb.png

Hi everyone! It's been a couple of days I've been struggling with retrieving the players country ID when accessing the leaderboard:

  • I've activated the tickbox on playfab for clients being able to retrieve the nation of other players when getting the leaderboard

  • As you can see in the image, I've added the profile constraint but somehow that prevents me from getting the player names. If I bypass the "set profile constraints" i get DisplayName, Position and stat value with no problems.

  • I've tried in many ways but I wasn't able to figure out how to get the country ID of the players so I can display a little country flag next to the player names.

I truly hope somebody can help me out with this, it's a little thing but I would love to make it work! Thank you in advance!

Leaderboards and Statistics
lb.png (351.3 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

In the LeaderBoard result array, you may get the "Profile" object first, and then get the "Locations" array object in the "Profile" object, and then you can get the location by iterating the locations array. For more information about the GetLeaderBoard API result, you may refer to Player Data Management - Get Leaderboard - REST API (PlayFab Client) | Microsoft Learn.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pietro martino avatar image pietro martino commented ·

Hey hi there! thank you I will give it a shot and let you know if it works :)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.