Add currency||doc135594

September 20, 2022

Format

 Player:addCurrency(coinName, count, reason) 
  • The class to which the function belongs:Player

Description

Added in-game currency.


Precautions

  • Suggested item as currency, not used as item
  • Be sure to check the "as currency" option addCurrency to be effective

Parameters

Variable name type Description
coinName string currency name
count int quantity
reason string Add reason, required


Code Samples

On the server side of the player entity templatemount script, when a registered player logs inCallback, add game currency

Trigger.addHandler(this:cfg(), "ENTITY_ENTER", function(context)
    local player = context.obj1
    player:addCurrency("green_currency", 1000, "enter")
end)