Advertisement
HyperFlame

Sieges CTF Update 5

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