Paste #8972: Ctf

Date: 2014/08/30 12:57:05 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


dCaptureTheFlag:
  type: world
  events:
#-----------------------------------------------------------# 
#Add Arena Info Then do Ctfreload   
#To create a arena simply do /ctfwand (ArenaName[Has to be one word]) Then select point 1 and point 2 
    on server start:
    - if <server.has_file[CaptureTheFlag/CTFConfig.yml.yml]> { 
      - announce "<red><&lb>dCTF<&rb> <green>Loading Ctf Config File"
      - yaml load:CaptureTheFlag/CTFConfig.yml id:CtfConfig
      } else { 
      - announce "<red><&lb>dCTF<&rb> <green>Creating Ctf Config File"
      - yaml create CaptureTheFlag/CTFConfig.yml id:dbroadcast_saves
      - yaml savefile:CaptureTheFlag/Config.yml id:CtfConfig
      } 

    on player clicks block:
    - if <player.has_flag[selectingSign]> {
      - flag global CtfSign<player.flag[signname]>:<context.location>
      - narrate "Block inside <global.flag[CtfSign]>"
      - sign type:wall_sign 1|<player.flag[signtext]> <context.location>
      - sign type:wall_sign 2|<global.flag[CurrentPlayers]>/20 <context.location>
      - flag player selectingSign:!
      } else {
      - foreach <server.list_flags[CtfSign]> {
        - if <global.flag[color]> == null {
        - flag player tcolor:Blue
        - flag global color:Red
        }
        } else if <global.flag[color]> == Red {
          - flag player tcolor:Red
          - flag global color:Blue
        } else if <global.flag[color]> == Blue {
          - flag player tcolor:Blue
          - flag global color:team
        }
    on player breaks block with i@SelectorWand:
      - if <player.has_flag[pos1s]> {
        - flag player pos2:<context.location>
        - narrate "Pos2:<player.flag[pos2]>"
        - flag player pos1s:!
        - narrate "Are you happy with your selections? Say yes to Create Arena"
        - flag player confirmation
        - determine cancelled
        } else {
        - flag player pos1:<context.location>
        - narrate "Pos1:<player.flag[pos1]>"
        - flag player pos1s
        - determine cancelled
        }
    on player chats:
      - if <player.has_flag[confirmation]> {
        - if <context.message> == Yes {
          - narrate "You create a arena within the coords <player.flag[pos1]>, and <player.flag[pos2]> named"
          }
        }
    on resetarenas command:
      - flag global arenanumber:<yaml[Config].list_keys[ArenaCount].size||0>
    on restartarenas command:
    - if <server.has_file[CaptureTheFlag/CTFConfig.yml.yml]> { 
      - announce "<red><&lb>dCTF<&rb> <green>Loading Capture the flag Config File"
      - yaml load:CaptureTheFlag/CTFConfig.yml id:CtfConfig
      } else { 
      - announce "<red><&lb>dCTF<&rb> <green>Creating Capture The Flag Config File"
      - yaml create id:CtfConfig
      - yaml savefile:CaptureTheFlag/CTFConfig.yml id:CtfConfig
      }
    on Ctf command:
    - if <context.args.get[1].is[==].to[help]||true> {
      - narrate "/ctf SignText (signname) (text) to create wall sign"
      - narrate "/ctf admin to view admin commands"
      - determine fulfilled
      } else if <context.args.get[1].is[==].to[admin]> {
      - narrate "/ctf resetarenas  to remove all arenas"
      - narrate "/ctf CreateArena (Arenaname)  to get wand for selecting arena"
      - narrate "/ctf ViewArenas"
      } else if <context.args.get[1].is[==].to[ViewArenas]> {
      - foreach <yaml[CtfConfig].list_keys[Arenas]> {
        - narrate "Key<&co> %value% <&co> <yaml[CtfConfig].read[Arenas.%value%.ArenaName]>"
        }
      } else if <context.args.get[1].is[==].to[CreateArena]> {
        - if <context.args.get[2].to[<context.args.size>].as_string.is[==].to[null]||true> {
          - narrate "Please add a arena name"
          } else {
          - define ArenaCount <yaml[Config].list_keys[Arenas].size||0>
          - define Arenaname <context.args.get[2].to[<context.args.size>].as_string>
          - yaml set Arenas.<def[ArenaCount].add[1].as_int>.ArenaName:%Arenaname% id:CtfConfig
          - yaml savefile:CaptureTheFlag/CTFConfig.yml id:CtfConfig
          - narrate "Created Arena <context.args[2]>"
          }
      } else {
      - narrate "/ctf SignText (signname) (text) to create wall sign"
      - narrate "/ctf admin to view admin commands"
      - determine fulfilled
      }
    - determine fulfilled

SelectorWand:
  type: item
  material: 349
  display name: <&3>Selection_Wand
  lore: 
  - <&3>Pos1 hit/break block <&7>Pos2 Hit/break again
  no_id: false