Sign In Register

How can we help you today?

Start a new topic

How to set amount of specific currency?

Hey there! I just set up how to add and remove currency with events and cloud code. 

But since our game allows offline play, I would like a proper way to set one specific currency amount, but I can't figure out the proper way of doing that.

Can someone give me a light? 

// Retrieve Gold Balance
var balance = player.getBalance("GOLD");
// Create a new Variable and debit the player
var DebitPlayer = player.debit("GOLD", balance, "Reason: Remove All Gold Balance");
// If TRUE then credit the player with 5500 GOLD
if (DebitPlayer) {"GOLD", 5500, "Add 5500, final value is.. 5500");

 Maybe there is a better method, but this is what i sort out in 1 minute.



Why isn't this in a tutorial for the different languages?

Login to post a comment