HyperScript
Docs

← All of the Docs Players

A currency of your own

structurecurrency "<name>":since 1.7.28

At the left margin: says what a new player starts with (start: 10) and the most anybody can have (max: 100000). Optional: without it a currency starts at 0 and has no most

currency "tokens":
    start: 5

command /tokens:
    players only: true
    trigger:
        set {_tokens} to currency "tokens" of player
        send "&7Tokens: &e%{_tokens}%"
Try it
expressioncurrency <name> of <who>since 1.7.28

What they have. Change it with set, add and subtract; it stops at nothing and at the most

on player kill:
    add 1 to currency "tokens" of player
    send "&e+1 token."
Try it
expressionpay <n> of currency <name> from <who> to <who>since 1.7.28

Move that much from one player to the other. Nothing happens if the first does not have it

command /tip <player>:
    players only: true
    trigger:
        if currency "tokens" of player < 1:
            send "&cYou have no tokens."
            stop
        pay 1 of currency "tokens" from player to arg.1
        send "&aYou tipped %arg.1% a token."
Try it
Guide and examples

Money without another plugin: currency "gems" of player is a balance that is saved with the player, never goes below nothing, and can be ranked.

currency "gems":
    start: 10
    max: 100000

command /gems:
    players only: true
    trigger:
        set {_gems} to currency "gems" of player
        send "&7You have &b%{_gems}% &7gems."

command /givegems <player> <amount>:
    permission: "gems.admin"
    trigger:
        set {_amount} to parse arg.2 as integer
        if {_amount} is not set:
            send "&cThat is not a number."
            stop
        add {_amount} to currency "gems" of arg.1
        set {_now} to currency "gems" of arg.1
        send "&a%arg.1% now has %{_now}% gems."

command /paygems <player> <amount>:
    players only: true
    trigger:
        set {_amount} to parse arg.2 as integer
        if {_amount} is not set or {_amount} < 1:
            send "&cHow many?"
            stop
        if currency "gems" of player < {_amount}:
            send "&cYou do not have that many gems."
            stop
        pay {_amount} of currency "gems" from player to arg.1
        send "&aYou paid %arg.1% %{_amount}% gems."
SyntaxMeaning
currency "<name>":At the left margin: says what a new player starts with (start: 10) and the most anybody can have (max: 100000). Optional: without it a currency starts at 0 and has no most
currency <name> of <who>What they have. Change it with set, add and subtract; it stops at nothing and at the most
pay <n> of currency <name> from <who> to <who>Move that much from one player to the other. Nothing happens if the first does not have it
  • A balance is the player's own saved variable {%player%.currency.<name>}. So it works for someone who is offline, top 10 players by {currency.gems} ranks it, and other plugins can show it as %hyperscript_player_currency.gems%.
  • pay to a player who is already at the most moves what fits and the rest is lost; check first if that can happen on your server.
  • This is separate from an economy plugin. balance of player is Vault's money; a currency here is the script's own. The addon HyperEconomy makes the two one: it hands Vault a currency of yours as the server's money.