Paste #122597: money system

Date: 2024/05/09 09:40:17 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


money_system_euro:
    type: economy
    debug: false
    priority: normal
    name single: Euro
    name plural: Euros
    digits: 2
    format: <[amount]>
    balance: <player.flag[money]>
    has: <player.flag[money].is[or_more].than[<[amount]>]>
    withdraw:
    - flag <player> money:-:<[amount]>
    deposit:
    - flag <player> money:+:<[amount]>

money_command:
    type: command
    debug: false
    name: money
    description: Money command
    permission: command.money
    usage: /money
    aliases:
    - pay
    script:
    - choose <context.alias>:
        - case pay:
            - if <context.args.is_empty>:
                - narrate "<&c>Nutze /pay [Name] [amount]"
                - stop
            - if <context.args.size> == 1:
                - narrate "<&c>Nutze /pay [Name] [amount]"
                - stop
            - if <context.args.size> > 1:
                - define inputName <context.args.first>
                - define target <server.match_player[<[inputName]>].if_null[null]>
                - if <[target]> == null:
                    - narrate "<&c>Spieler mit den Namen <&e><[inputName]><&c> nicht gefunden!"
                    - stop
                - if <[target]> == <player>:
                    - narrate "<&c>Du kannst dir nichts selbst senden!"
                    - stop
                - define amount <context.args.get[2]>
                - if !<[amount].is_decimal>:
                    - narrate "<&c>Keine gültige Geld angabe!"
                    - stop
                - if !<[amount]> > 0:
                    - narrate "<&c>Keine gültige Geld angabe!"
                    - stop
                - if !<player.money.is[or_more].than[<[amount]>]>:
                    - narrate "<&c>Du hast nicht genug Geld!"
                    - stop
                - money take players:<player> quantity:<[amount].round_to[2]>
                - money give players:<[target]> quantity:<[amount].round_to[2]>
                - narrate "<&a>Du hast <[target].name> erfolgreich <[amount]>€ gesendet!"
                - narrate "<&a>Du hast <[amount]>€ von <player.name> erhalten!" targets:<[target]>