question

hunelgames avatar image
hunelgames asked

Maximum purchase transaction.

Hi,

There is a market in my game.There are 6 buffs in the market.

I want the player to buy a maximum of 3 buffs. How can I do that ?

I added "buff count" statistic to each player."buff count" statistic increases by 1 when 1 buff is purchased.

This system is working properly. But if the player buys 5-6 buffs one after another , the system does not work because the purchasing process is faster than the update of the "buff count" statistic.

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

·
Ivan Cai avatar image
Ivan Cai answered

When a player is purchasing a buff, you can first call the GetUserInventory API and check the current number of buffs in the player's inventory. If the quantity is less than or equal to 3 after adding this purchase, you can purchase and execute the purchase operation. Otherwise, the player is notified that the purchase quantity has reached the upper limit and can‘t be purchased.

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.