Advertisement
HyperFlame

Sieges CTF

Jun 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.95 KB | None | 0 0
  1. #Sieges CTF Plugin by HyperFlame
  2.  
  3. function defaultkit(p: player):
  4. clear the inventory of {_p}
  5. set chestplate of {_p} to iron chestplate
  6. set leggings of {_p} to iron leggings
  7. set boots of {_p} to iron boots
  8. give iron sword to {_p}
  9. give bow to {_p}
  10. give 64 arrows to {_p}
  11.  
  12. command /ctf [<text>] [<text>]:
  13. description: Master command for capture the flag.
  14. permission: skript.ctf
  15. trigger:
  16. if arg 1 is "join":
  17. if {ctf.playercount} is 12:
  18. send "&CThere are already 12 players in this game. Chill in the lobby or something until the next game." to player
  19. else:
  20. if {ctf.%player%.team} is set:
  21. send "&cYou have already joined the game." to player
  22. else:
  23. if {ctf.game} is true:
  24. send "&cThe game has already started. Chill in the lobby or something until the next game." to player
  25. else:
  26. if {ctf.team.red} is greater than {ctf.team.blue}:
  27. set {ctf.%player%.team} to "blue"
  28. add player to {ctf.blue::*}
  29. add 1 to {ctf.team.blue}
  30. add 1 to {ctf.playercount}
  31. send "&eYou joined team &1Blue&e." to player
  32. if {ctf.playercount} is 6:
  33. broadcast "&eGame starting in &a30 &eseconds."
  34. wait 15 seconds
  35. broadcast "&eGame starting in &e15 &eseconds."
  36. wait 5 seconds
  37. broadcast "&eGame starting in &e10 &eseconds."
  38. wait 5 seconds
  39. broadcast "&eGame starting in &c5 &eseconds."
  40. wait 1 second
  41. broadcast "&eGame starting in &c4 &eseconds."
  42. wait 1 second
  43. broadcast "&eGame starting in &c3 &eseconds."
  44. wait 1 second
  45. broadcast "&eGame starting in &c2 &eseconds."
  46. wait 1 second
  47. broadcast "&eGame starting in &c1 &eseconds."
  48. wait 1 second
  49. broadcast "&eGame now starting."
  50. execute console command "ctf admin start"
  51. else if {ctf.team.blue} is greater than {ctf.team.red}:
  52. set {ctf.%player%.team} to "red"
  53. add player to {ctf.red::*}
  54. add 1 to {ctf.team.red}
  55. add 1 to {ctf.playercount}
  56. send "&eYou joined team &cRed&e." to player
  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. send "&eYou joined team &cRed&e." to player
  82. if {ctf.playercount} is 6:
  83. broadcast "&eGame starting in &a30 &eseconds."
  84. wait 15 seconds
  85. broadcast "&eGame starting in &e15 &eseconds."
  86. wait 5 seconds
  87. broadcast "&eGame starting in &e10 &eseconds."
  88. wait 5 seconds
  89. broadcast "&eGame starting in &c5 &eseconds."
  90. wait 1 second
  91. broadcast "&eGame starting in &c4 &eseconds."
  92. wait 1 second
  93. broadcast "&eGame starting in &c3 &eseconds."
  94. wait 1 second
  95. broadcast "&eGame starting in &c2 &eseconds."
  96. wait 1 second
  97. broadcast "&eGame starting in &c1 &eseconds."
  98. wait 1 second
  99. broadcast "&eGame now starting."
  100. execute console command "ctf admin start"
  101. else if arg 1 is "leave":
  102. if {ctf.%player%.team} is not set:
  103. send "&cYou have not joined the game." to player
  104. else:
  105. delete {ctf.%player%.team}
  106. remove 1 from {ctf.playercount}
  107. loop {ctf.red::*}:
  108. loop-value contains player:
  109. remove player from {ctf.red::*}
  110. remove 1 from {ctf.team.red}
  111. loop {ctf.blue::*}:
  112. loop-value contains player:
  113. remove player from {ctf.blue::*}
  114. remove 1 from {ctf.team.blue}
  115. if {ctf.game} is true:
  116. execute player command "/spawn"
  117. clear the inventory of the player
  118. else if arg 1 is "admin":
  119. if player does not have permission "skript.ctf.admin":
  120. send "&cYou don't have permission to control the game." to player
  121. else if arg 2 is not set:
  122. send "&cPlease define a valid command." to player
  123. else if arg 2 is "start":
  124. if {ctf.game} is true:
  125. send "&cThe game has already started." to player
  126. else:
  127. set {ctf.game} to true
  128. loop {ctf.red::*}:
  129. teleport loop-value to {ctf.red.spawn}
  130. set gamemode of loop-value to survival
  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. set gamemode of loop-value to survival
  136. defaultkit(loop-value)
  137. send "&bCapture the enemy flag &a3 &btimes to win the game!" to loop-value
  138. else if arg 2 is "stop":
  139. if {ctf.game} is false:
  140. send "&cThere is no game currently being played." to player
  141. else:
  142. set {ctf.game} to false
  143. set {ctf.playercount} to 0
  144. set {ctf.team.red} to 0
  145. set {ctf.team.blue} to 0
  146. delete {ctf.red.capture}
  147. delete {ctf.blue.capture}
  148. loop {ctf.red::*}:
  149. delete {ctf.%loop-value%.team}
  150. delete {ctf.flag.%loop-value%}
  151. clear the inventory of loop-value
  152. execute loop-value command "/spawn"
  153. loop {ctf.blue::*}:
  154. delete {ctf.%loop-value%.team}
  155. delete {ctf.flag.%loop-value%}
  156. clear the inventory of loop-value
  157. execute loop-value command "/spawn"
  158. delete {ctf.red::*}
  159. delete {ctf.blue::*}
  160. broadcast "&eThe game has been stopped."
  161. loop all players:
  162. delete {ctf.%loop-value%.team}
  163. else if arg 2 is "clearspawns":
  164. delete {ctf.red.spawn}
  165. delete {ctf.blue.spawn}
  166. send "&aSpawns removed." to player
  167. else:
  168. send "&cInvalid command." to player
  169. else:
  170. send "&cInvalid command." to player
  171. on right click:
  172. if {ctf.game} is false:
  173. stop
  174. else:
  175. if event-block is red standing banner:
  176. if event-location is {ctf.blue.flag}:
  177. if {ctf.flag.%player%} is set:
  178. set helmet of player to air
  179. add 1 to {ctf.red.capture}
  180. set block at {ctf.blue.flag} to blue standing banner
  181. delete {ctf.flag.%player%}
  182. give iron sword to player
  183. give bow to player
  184. broadcast "&4!!! &c%player% &ehas captured &1Blue's &eflag!"
  185. else:
  186. loop {ctf.blue::*}:
  187. if loop-value does not contain player:
  188. stop
  189. else:
  190. delete block at event-location
  191. set helmet of player to red standing banner
  192. set {ctf.flag.%player%} to true
  193. broadcast "&4!!! &1%player% &ehas stolen &cRed's &eflag!"
  194. remove iron sword from the inventory of the player
  195. remove bow from the inventory of the player
  196. else:
  197. loop {ctf.blue::*}:
  198. if loop-value does not contain player:
  199. delete block at event-location
  200. set block at {ctf.red.flag} to red standing banner
  201. broadcast "&cRed's &eflag has been returned to their base."
  202. else:
  203. delete event-block
  204. set helmet of player to red standing banner
  205. set {ctf.flag.%player%} to true
  206. broadcast "&4!!! &1%player% &ehas stolen &cRed's &eflag!"
  207. remove iron sword from the inventory of the player
  208. remove bow from the inventory of the player
  209. if event-block is blue standing banner:
  210. if event-location is {ctf.red.flag}:
  211. if {ctf.flag.%player%} is set:
  212. set helmet of player to air
  213. add 1 to {ctf.blue.capture}
  214. set block at {ctf.red.flag} to red standing banner
  215. delete {ctf.flag.%player%}
  216. give iron sword to player
  217. give bow to player
  218. broadcast "&4!!! &1%player% &ehas captured &cRed's &eflag!"
  219. else:
  220. loop {ctf.red::*}:
  221. if loop-value does not contain player:
  222. stop
  223. else:
  224. delete block at event-location
  225. set helmet of player to blue standing banner
  226. set {ctf.flag.%player%} to true
  227. broadcast "&4!!! &c%player% &ehas stolen &1Blue's &eflag!"
  228. remove iron sword from the inventory of the player
  229. remove bow from the inventory of the player
  230. else:
  231. loop {ctf.red::*}:
  232. if loop-value does not contain player:
  233. delete block at event-location
  234. set block at {ctf.blue.flag} to blue standing banner
  235. broadcast "&1Blue's &eflag has been returned to their base."
  236. else:
  237. delete event-block
  238. set helmet of player to red standing banner
  239. set {ctf.flag.%player%} to true
  240. broadcast "&4!!! &c%player% &ehas stolen &1Blue's &eflag!"
  241. remove iron sword from the inventory of the player
  242. remove bow from the inventory of the player
  243. else:
  244. stop
  245.  
  246. on place of redstone block:
  247. if block under event-block is red wool block:
  248. if {ctf.red.spawn} is set:
  249. send "&cRed's spawn has already been set" to player
  250. else:
  251. cancel event
  252. set {ctf.red.spawn} to event-location
  253. send "&aRed's spawn set."
  254. if block under event-block is red wool block:
  255. if {ctf.blue.spawn} is set:
  256. send "&cBlue's spawn has already been set" to player
  257. else:
  258. cancel event
  259. set {ctf.blue.spawn} to event-location
  260. send "&aBlue's spawn set."
  261. if block under event-block is redstone block:
  262. if {ctf.red.flag} is set:
  263. send "&cRed's flag has already been set" to player
  264. else:
  265. cancel event
  266. set {ctf.red.flag} to event-location
  267. set block at {ctf.red.flag} to red standing banner
  268. send "&aRed's flag set."
  269. if block under event-block is lapis lazuli block:
  270. if {ctf.blue.flag} is set:
  271. send "&cBlue's flag has already been set" to player
  272. else:
  273. cancel event
  274. set {ctf.blue.flag} to event-location
  275. set block at {ctf.blue.flag} to blue standing banner
  276. send "&aBlue's flag set."
  277.  
  278. on death:
  279. clear drops
  280. if {ctf.flag.%player%} is not set:
  281. stop
  282. else:
  283. set {_flaglocation} to event-location
  284. loop {ctf.blue::*}:
  285. if loop-value does not contain player:
  286. stop
  287. else:
  288. set block at {_flaglocation} to red standing banner
  289. delete {ctf.flag.%player%}
  290. broadcast "&1%player% &ehas dropped &cRed's &eflag!"
  291. loop {ctf.red::*}:
  292. if loop-value does not contain player:
  293. stop
  294. else:
  295. set block at {_flaglocation} to blue standing banner
  296. delete {ctf.flag.%player%}
  297. broadcast "&c%player% &ehas dropped &1Blue's &eflag!"
  298.  
  299. on load:
  300. broadcast "&6CTF Skript Loaded (V0.8 by HyperFlame)"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement