question

Joseph Somday avatar image
Joseph Somday asked

How do I add currency to a single user and then to ALL users?,How do I add currency to a single user and then to all users?

Basically, I have a game where a user can earn a point (virtual currency #1). Once they earn a point it's entered into a pool that contains ALL user's points (virtual currency #2) that play the game. The user, in game, can view their amount of points and the total amount of points entered by all users. How can I make a Cloud Script that will add to the user's point's and automatically add to a pool of all user's points?

,

Basically, I have a game where a user earns a point (virtual currency). Those points are put into a pool that contains all user's points (another virtual currency) that play the game. In my game the user can view how many points they have and how many total points are entered by all users. How can I make a cloud script that adds virtual currency to the user and also automatically adds another virtual currency to ALL users?

Player DataCloudScriptscheduled tasks
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

·
Citrus Yan avatar image
Citrus Yan answered

For adding currency to a single user, you can use the AddUserVirtualCurrency API in CloudScript to do that. However, in the second case, it’s possible that multiple players may be trying to read/write the same data at the same time, which might raise concurrency issues, therefore, you may need an external service such as Redis to track this.

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.