question

RedRain Team avatar image
RedRain Team asked

Leaderboard Information in Push Notification

Hello Guys,

So i am trying to send a push notification once the leaderboard Resets, i am trying to send a custom push notification in Cloud Script:

  • I want the push notification to be vary based on the Rank
  • I want the the data in Title Data is changed as well like SurvivalSeason and Reward Amount

However this returns error, how do i get the leaderboard information ? Thank you !

Push NotificationsTitle DataLeaderboards and Statistics
3 comments
10 |1200

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

Sarah Zhang avatar image Sarah Zhang commented ·

Could you please provide the relevant code snippets and the specific error messages? Please notice hide the private info.

0 Likes 0 ·
RedRain Team avatar image RedRain Team commented ·

@Sarah Zhang this is weird, i was sure i attached the Code Snippets, but anyway here is the code snippets



Also what do you mean by "Please notice hide the private info" ?

Thank you

0 Likes 0 ·
capture.png (13.6 KiB)
Sarah Zhang avatar image Sarah Zhang RedRain Team commented ·

Thanks for the clarification, we will research it.

It means we don't collect the personal data that is not related with question. If the code contains the any real name, password, secret key, etc. They need to be hided, or replaced to some placeholders.

0 Likes 0 ·

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

Firstly, there is no server API GetLeaderboardAroundPlayer, there is only client API GetLeaderboardAroundPlayer. This server API should be GetLeaderboardAroundUser. Besides, if you want to get the current player’s statistic value, you can call the server API GetPlayerStatistics directly instead of GetLeaderboardAroundUser. Then we would suggest you store the history statistic value as Player Read-Only Data, not Player Data, because Player Data can be modified by players. For your requirements, you can use server API SetTitleData to update the title data, and use server API SendPushNotification to send the custom notification to players.

2 comments
10 |1200

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

RedRain Team avatar image RedRain Team commented ·

I need to get LeaderboardAroundUser for the rank position and GetPlayerStatistic only for the Statistic Value right ? So, conclude from your answer, do i only need to write as simple as
client.GetLeaderboardAroundPlayer ?

Thank you for the warning ! will do

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang RedRain Team commented ·

Yes, you are right, if you need to retrieve the player's ranking on CloudScript, please use

server.GetLeaderboardAroundUser

CloudScript can't access client API.

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.