Advertisement
HyperFlame

CTF Update

Jun 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.80 KB | None | 0 0
  1. #Games: Minimum player count needed
  2. #Teams: Random
  3. #Flags: Banners, When held you cannot attack
  4. #CTF Developed for Sieges by HyperFlame
  5. #Version 0.1
  6.  
  7.  
  8. function defaultkit(p: player):
  9. set chestplate of {_p} to iron chestplate
  10. set leggings of {_p} to iron leggings
  11. set boots of {_p} to iron boots
  12. give iron sword to {_p}
  13. give bow to {_p}
  14. give 64 arrows to {_p}
  15.  
  16. command /ctf [<text>] [<text>]:
  17. description: Master command for capture the flag.
  18. permission: skript.ctf
  19. trigger:
  20. if arg 1 is "join":
  21. if {ctf.playercount} is 12:
  22. send "&CThere are already 12 players in this game. Chill in the lobby or something until the next game." to player
  23. else if {ctf.%player%.team} is set:
  24. send "&cYou have already joined the game." to player
  25. else if {ctf.game} is true:
  26. send "&cThe game has already started. Chill in the lobby or something until the next game." to player
  27. else:
  28. if {ctf.team.red} is greater than {ctf.team.blue}:
  29. set {ctf.%player%.team} to "blue"
  30. add player to {ctf.blue::*}
  31. add 1 to {ctf.team.blue}
  32. add 1 to {ctf.playercount}
  33. if {ctf.playercount} is 6:
  34. broadcast "&eGame starting in &a30 &eseconds."
  35. wait 15 seconds
  36. broadcast "&eGame starting in &e15 &eseconds."
  37. wait 5 seconds
  38. broadcast "&eGame starting in &e10 &eseconds."
  39. wait 5 seconds
  40. broadcast "&eGame starting in &c5 &eseconds."
  41. wait 1 second
  42. broadcast "&eGame starting in &c4 &eseconds."
  43. wait 1 second
  44. broadcast "&eGame starting in &c3 &eseconds."
  45. wait 1 second
  46. broadcast "&eGame starting in &c2 &eseconds."
  47. wait 1 second
  48. broadcast "&eGame starting in &c1 &eseconds."
  49. wait 1 second
  50. broadcast "&eGame now starting."
  51. execute console command "ctf admin start"
  52. else if {ctf.team.blue} is greater than {ctf.team.red}:
  53. set {ctf.%player%.team} to "red"
  54. add player to {ctf.red::*}
  55. add 1 to {ctf.team.red}
  56. add 1 to {ctf.playercount}
  57. if {ctf.playercount} is 6:
  58. broadcast "&eGame starting in &a30 &eseconds."
  59. wait 15 seconds
  60. broadcast "&eGame starting in &e15 &eseconds."
  61. wait 5 seconds
  62. broadcast "&eGame starting in &e10 &eseconds."
  63. wait 5 seconds
  64. broadcast "&eGame starting in &c5 &eseconds."
  65. wait 1 second
  66. broadcast "&eGame starting in &c4 &eseconds."
  67. wait 1 second
  68. broadcast "&eGame starting in &c3 &eseconds."
  69. wait 1 second
  70. broadcast "&eGame starting in &c2 &eseconds."
  71. wait 1 second
  72. broadcast "&eGame starting in &c1 &eseconds."
  73. wait 1 second
  74. broadcast "&eGame now starting."
  75. execute console command "ctf admin start"
  76. else if {ctf.team.blue} is equal to {ctf.team.red}:
  77. set {ctf.%player%.team} to "red"
  78. add player to {ctf.red::*}
  79. add 1 to {ctf.team.red}
  80. add 1 to {ctf.playercount}
  81. if {ctf.playercount} is 6:
  82. broadcast "&eGame starting in &a30 &eseconds."
  83. wait 15 seconds
  84. broadcast "&eGame starting in &e15 &eseconds."
  85. wait 5 seconds
  86. broadcast "&eGame starting in &e10 &eseconds."
  87. wait 5 seconds
  88. broadcast "&eGame starting in &c5 &eseconds."
  89. wait 1 second
  90. broadcast "&eGame starting in &c4 &eseconds."
  91. wait 1 second
  92. broadcast "&eGame starting in &c3 &eseconds."
  93. wait 1 second
  94. broadcast "&eGame starting in &c2 &eseconds."
  95. wait 1 second
  96. broadcast "&eGame starting in &c1 &eseconds."
  97. wait 1 second
  98. broadcast "&eGame now starting."
  99. execute console command "ctf admin start"
  100. else if arg 1 is "leave":
  101. if {ctf.%player%.team} is not set:
  102. send "&cYou have not joined the game." to player
  103. else:
  104. delete {ctf.%player%.team}
  105. remove 1 from {ctf.playercount}
  106. loop {ctf.red::*}:
  107. loop-value contains player:
  108. remove player from {ctf.red::*}
  109. remove 1 from {ctf.team.red}
  110. loop {ctf.blue::*}:
  111. loop-value contains player:
  112. remove player from {ctf.blue::*}
  113. remove 1 from {ctf.team.blue}
  114. if {ctf.game} is true:
  115. execute player command "/spawn"
  116. clear the inventory of the player
  117. else if arg 1 is "admin":
  118. if player does not have permission "skript.ctf.admin":
  119. send "&cYou don't have permission to control the game." to player
  120. else if arg 2 is not set:
  121. send "&cPlease define a valid command." to player
  122. else if arg 2 is "start":
  123. if {ctf.game} is true:
  124. send "&cThe game has already started." to player
  125. else:
  126. set {ctf.game} to true
  127. loop {ctf.red::*}:
  128. teleport loop-value to {ctf.red.spawn}
  129. defaultkit(loop-value)
  130. send "&bCapture the enemy flag &a3 &btimes to win the game!" to loop-value
  131. loop {ctf.blue::*}:
  132. teleport loop-value to {ctf.blue.spawn}
  133. defaultkit(loop-value)
  134. send "&bCapture the enemy flag &a3 &btimes to win the game!" to loop-value
  135. else if arg 2 is "stop":
  136. if {ctf.game} is false:
  137. send "&cThere is no game currently being played." to player
  138. else:
  139. set {ctf.game} to false
  140. set {ctf.playercount} to 0
  141. delete {ctf.team.red}
  142. delete {ctf.team.blue}
  143. delete {ctf.red.capture}
  144. delete {ctf.blue.capture}
  145. loop {ctf.red::*}:
  146. delete {ctf.%loop-value%.team}
  147. delete {ctf.flag.%loop-value%}
  148. execute loop-value command "/spawn"
  149. loop {ctf.blue::*}:
  150. delete {ctf.%loop-value%.team}
  151. delete {ctf.flag.%loop-value%}
  152. execute loop-value command "/spawn"
  153. delete {ctf.red::*}
  154. delete {ctf.blue::*}
  155. broadcast "&eThe game has been stopped."
  156.  
  157. on right click:
  158. if {ctf.game} is false:
  159. stop
  160. else:
  161. if event-block is red standing banner:
  162. if {ctf.flag.%player%} is set:
  163. set helmet of player to air
  164. add 1 to {ctf.red.capture}
  165. set block at {ctf.blue.flag} to blue standing banner
  166. delete {ctf.flag.%player%}
  167. broadcast "&4!!! &c%player% &ehas captured &1Blue's &eflag!"
  168. else:
  169. loop {ctf.blue::*}:
  170. if loop-value does not contain player:
  171. stop
  172. else:
  173. delete event-block
  174. set helmet of player to red standing banner
  175. set {ctf.flag.%player%} to true
  176. broadcast "&4!!! &1%player% &ehas stolen &cRed's &eflag!"
  177. remove iron sword from the inventory of the player
  178. if event-block is blue standing banner:
  179. if {ctf.flag.%player%} is set:
  180. set helmet of player to air
  181. add 1 to {ctf.blue.capture}
  182. set block at {ctf.red.flag} to red standing banner
  183. delete {ctf.flag.%player%}
  184. broadcast "&4!!! &1%player% &ehas captured &cRed's &eflag!"
  185. else:
  186. loop {ctf.red::*}:
  187. if loop-value does not contain player:
  188. stop
  189. else:
  190. delete event-block
  191. set helmet of player to blue standing banner
  192. set {ctf.flag.%player%} to true
  193. broadcast "&4!!! &c%player% &ehas stolen &1Blue's &eflag!"
  194. remove iron sword from the inventory of the player
  195. else:
  196. stop
  197.  
  198. on place of redstone block:
  199. if block under event-block is red wool block:
  200. cancel event
  201. set {ctf.red.spawn} to event-location
  202. send "&aSpawn set."
  203. if block under event-block is blue wool block:
  204. cancel event
  205. set {ctf.blue.spawn} to event-location
  206. send "&aSpawn set."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement