Paste #39637: Setcode

Date: 2017/02/06 11:53:28 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


Setcodecommand:
  type: command
  name: setcode
  usage: /setcode <code> <xp|medallions|playpoints|tournamentpoints> <amount> <time limit (in days)>
  description: Manually sets a server-wide code for rewards.
  script:
  - if !<player.is_op||<context.server>> { 
    - narrate "<&c>You do not have permission for that command." 
    - queue clear 
    }
  - if <context.args.size.is[OR_LESS].than[3]> || <li@xp|medallions|playpoints|tournamentpoints.contains[<context.args.get[2]>]> || !<context.args.get[3].is[matches].to[number]> || !<context.args.get[4].is[matches].to[number]>{
    - narrate "<&c>Usage: /setcode <&lt>code<&gt> <&lt>xp|medallions|playpoints|tournamentpoints<&gt> <&lt>amount<&gt> <&lt>time limit (in days)<&gt>"
    - queue clear
    } else {
    - flag server servercode.activecodes:<context.args.get[1]> duration:<context.args.get[4].as_int.in_days>
    - flag server <context.args.get[1]>:<context.args.get[3].as_int><context.args.get[2]> duration:<context.args.get[4].as_int.in_days>
    - flag <server.list_players> <context.args.get[1]>:<context.args.get[3].as_int><context.args.get[2]> duration:<context.args.get[4].as_int.in_days>
    }