Advertisement
HyperFlame

Untitled

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