Paste #44077: player flag expiration

Date: 2017/09/02 07:46:46 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#nothing to see here
#move along
Arnash:
    type: assignment

    default constants:

        Race Change Cooldown: 7d

    actions:
        on assignment:
        - trigger name:click state:true
        - trigger name:chat state:true
    interact scripts:
    - 1 Arnashinteract

Arnashinteract:
    type: interact
    speed: 3
    steps:
        1:
            click trigger:
                script:
                - engage
                - chat "Hello, <player.name>!"
                - wait 2s
                - chat "I am able to change your Race to Arashi."
                - wait 2s
                - chat "This will cost $500."
                - wait 1s
                - narrate "<&f>Type <&9><&o>Yes <&r><&f>or <&9><&o>No"
                - disengage
            chat trigger:
                1:
                    trigger: /Yes/ I would like to join the Arashi.
                    script:
                    - if <player.has_flag[Race_Changed]> {
                     - chat "You can change your race in <player.flag[Race_Changed].expiration>"
                    }
                    else {
                     - if <player.money> >= 500 {
                     - engage
                     - wait 2s
                     - execute as_op "eco take <player.name> 500"
                     - execute as_op "race set Arashi <player.name>"
                     - flag <player> Race_changed "duration:7d"
                     - disengage
                    }
                    else {
                     - engage
                     - chat "Sorry, I can't take less than $500 for my services."
                     - disengage
                    }
                    }
                2:
                    trigger: /No/ I would rather not.