question

brendan avatar image
brendan asked

Login rewards

Question from a developer:

I am trying to do a system to give players login rewards for consecutive daily logins that reset at 30 consecutive daily logins. If the player log in for 3 days, then misses 1 and logs in on the 5th day, he should receive the login rewards for days 1, 2, and 3, and then be reset to 1 on day 5 (since he didn't log in on day 4).

So, in tracking this, would I use currTimeSeconds to track the daily process? Also, is this time based on a particular region?

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

·
brendan avatar image
brendan answered

In the processPlayerMove handler in our basic Cloud Script sample (added to all new titles on creation, but also available in our GitHub here: https://github.com/PlayFab/CloudScriptSamples/blob/master/BasicSample/basic_sample.js), we use the Date call to get the timestamp. All our servers run on UTC, so you can use that as the basis to determine what time you want to use in tracking any particular user's daily usage. What we would recommend is using Cloud Script for your key actions, and to record the player's last action timestamp (via Date) in User Read Only Data. That way, you can check that in an onLogin handler, and give the player the appropriate rewards.

10 |1200

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

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.