Advertisement
HyperFlame

Untitled

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