Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Games: Minimum player count needed
- #Teams: Random
- #Flags: Banners, When held you cannot attack
- #CTF Developed for Sieges by HyperFlame
- #Version 0.1
- function defaultkit(p: player):
- set chestplate of {_p} to iron chestplate
- set leggings of {_p} to iron leggings
- set boots of {_p} to iron boots
- give iron sword to {_p}
- give bow to {_p}
- give 64 arrows to {_p}
- command /ctf [<text>] [<text>]:
- description: Master command for capture the flag.
- permission: skript.ctf
- trigger:
- if arg 1 is "join":
- if {ctf.playercount} is 12:
- send "&CThere are already 12 players in this game. Chill in the lobby or something until the next game." to player
- else if {ctf.%player%.team} is set:
- send "&cYou have already joined the game." to player
- else if {ctf.game} is true:
- send "&cThe game has already started. Chill in the lobby or something until the next game." to player
- else:
- if {ctf.team.red} is greater than {ctf.team.blue}:
- set {ctf.%player%.team} to "blue"
- add player to {ctf.blue::*}
- add 1 to {ctf.team.blue}
- add 1 to {ctf.playercount}
- if {ctf.playercount} is 6:
- broadcast "&eGame starting in &a30 &eseconds."
- wait 15 seconds
- broadcast "&eGame starting in &e15 &eseconds."
- wait 5 seconds
- broadcast "&eGame starting in &e10 &eseconds."
- wait 5 seconds
- broadcast "&eGame starting in &c5 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c4 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c3 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c2 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c1 &eseconds."
- wait 1 second
- broadcast "&eGame now starting."
- execute console command "ctf admin start"
- else if {ctf.team.blue} is greater than {ctf.team.red}:
- set {ctf.%player%.team} to "red"
- add player to {ctf.red::*}
- add 1 to {ctf.team.red}
- add 1 to {ctf.playercount}
- if {ctf.playercount} is 6:
- broadcast "&eGame starting in &a30 &eseconds."
- wait 15 seconds
- broadcast "&eGame starting in &e15 &eseconds."
- wait 5 seconds
- broadcast "&eGame starting in &e10 &eseconds."
- wait 5 seconds
- broadcast "&eGame starting in &c5 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c4 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c3 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c2 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c1 &eseconds."
- wait 1 second
- broadcast "&eGame now starting."
- execute console command "ctf admin start"
- else if {ctf.team.blue} is equal to {ctf.team.red}:
- set {ctf.%player%.team} to "red"
- add player to {ctf.red::*}
- add 1 to {ctf.team.red}
- add 1 to {ctf.playercount}
- if {ctf.playercount} is 6:
- broadcast "&eGame starting in &a30 &eseconds."
- wait 15 seconds
- broadcast "&eGame starting in &e15 &eseconds."
- wait 5 seconds
- broadcast "&eGame starting in &e10 &eseconds."
- wait 5 seconds
- broadcast "&eGame starting in &c5 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c4 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c3 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c2 &eseconds."
- wait 1 second
- broadcast "&eGame starting in &c1 &eseconds."
- wait 1 second
- broadcast "&eGame now starting."
- execute console command "ctf admin start"
- else if arg 1 is "leave":
- if {ctf.%player%.team} is not set:
- send "&cYou have not joined the game." to player
- else:
- delete {ctf.%player%.team}
- remove 1 from {ctf.playercount}
- loop {ctf.red::*}:
- loop-value contains player:
- remove player from {ctf.red::*}
- remove 1 from {ctf.team.red}
- loop {ctf.blue::*}:
- loop-value contains player:
- remove player from {ctf.blue::*}
- remove 1 from {ctf.team.blue}
- if {ctf.game} is true:
- execute player command "/spawn"
- clear the inventory of the player
- else if arg 1 is "admin":
- if player does not have permission "skript.ctf.admin":
- send "&cYou don't have permission to control the game." to player
- else if arg 2 is not set:
- send "&cPlease define a valid command." to player
- else if arg 2 is "start":
- if {ctf.game} is true:
- send "&cThe game has already started." to player
- else:
- set {ctf.game} to true
- loop {ctf.red::*}:
- teleport loop-value to {ctf.red.spawn}
- defaultkit(loop-value)
- send "&bCapture the enemy flag &a3 &btimes to win the game!" to loop-value
- loop {ctf.blue::*}:
- teleport loop-value to {ctf.blue.spawn}
- defaultkit(loop-value)
- send "&bCapture the enemy flag &a3 &btimes to win the game!" to loop-value
- else if arg 2 is "stop":
- if {ctf.game} is false:
- send "&cThere is no game currently being played." to player
- else:
- set {ctf.game} to false
- set {ctf.playercount} to 0
- delete {ctf.team.red}
- delete {ctf.team.blue}
- delete {ctf.red.capture}
- delete {ctf.blue.capture}
- loop {ctf.red::*}:
- delete {ctf.%loop-value%.team}
- delete {ctf.flag.%loop-value%}
- execute loop-value command "/spawn"
- loop {ctf.blue::*}:
- delete {ctf.%loop-value%.team}
- delete {ctf.flag.%loop-value%}
- execute loop-value command "/spawn"
- delete {ctf.red::*}
- delete {ctf.blue::*}
- broadcast "&eThe game has been stopped."
- on right click:
- if {ctf.game} is false:
- stop
- else:
- if event-block is red standing banner:
- if {ctf.flag.%player%} is set:
- set helmet of player to air
- add 1 to {ctf.red.capture}
- set block at {ctf.blue.flag} to blue standing banner
- delete {ctf.flag.%player%}
- broadcast "&4!!! &c%player% &ehas captured &1Blue's &eflag!"
- else:
- loop {ctf.blue::*}:
- if loop-value does not contain player:
- stop
- else:
- delete event-block
- set helmet of player to red standing banner
- set {ctf.flag.%player%} to true
- broadcast "&4!!! &1%player% &ehas stolen &cRed's &eflag!"
- remove iron sword from the inventory of the player
- if event-block is blue standing banner:
- if {ctf.flag.%player%} is set:
- set helmet of player to air
- add 1 to {ctf.blue.capture}
- set block at {ctf.red.flag} to red standing banner
- delete {ctf.flag.%player%}
- broadcast "&4!!! &1%player% &ehas captured &cRed's &eflag!"
- else:
- loop {ctf.red::*}:
- if loop-value does not contain player:
- stop
- else:
- delete event-block
- set helmet of player to blue standing banner
- set {ctf.flag.%player%} to true
- broadcast "&4!!! &c%player% &ehas stolen &1Blue's &eflag!"
- remove iron sword from the inventory of the player
- else:
- stop
- on place of redstone block:
- if block under event-block is red wool block:
- cancel event
- set {ctf.red.spawn} to event-location
- send "&aSpawn set."
- if block under event-block is blue wool block:
- cancel event
- set {ctf.blue.spawn} to event-location
- send "&aSpawn set."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement