Advertisement
Guest User

Custom Team Creation

a guest
Apr 26th, 2015
3,754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.60 KB | None | 0 0
  1. #variables
  2. #{Teams::%id%} - list of integer - all team numbers currently active
  3. #loop-index = loop-value - so {Teams::%id%} to check if team exists
  4.  
  5. #{Team.%integer%::*} - list of "text" - player names in that team (TEXT!)
  6. #{Teams.InTeam::%player%} - integer/null - what team is player in?
  7.  
  8. options:
  9. P: &f[&aTeams&f]&7
  10. N: &c&o%command sender%:&b
  11. S: &7
  12. IS: Invalid Syntax. &c/tm help&b?
  13. on: &a&lenabled
  14. off: &c&Ldisabled
  15. C: &7
  16. H: &d&L
  17.  
  18. command /teams [<text>]:
  19. permission: skript.op
  20. trigger:
  21. if arg-1 is "on" or "enable":
  22. set {teams} to true
  23. broadcast "{@P} Team management has been enabled."
  24. broadcast ""
  25. broadcast " {@S}- {@H}/team create &8&L|{@C} Create a team!"
  26. broadcast " {@S}- {@H}/team invite &8&L|{@C} Invite a player to your team!"
  27. broadcast " {@S}- {@H}/team &8&L|{@C} List all commands!"
  28. broadcast ""
  29. command "/aps note.bass"
  30. else if arg-1 is "off" or "disable":
  31. delete {teams}
  32. broadcast "{@P} Team management has been disabled."
  33. command "/aps note.bass"
  34.  
  35. command /team [<text>] [<player>]:
  36. trigger:
  37. if arg-1 is not set:
  38. if {teams} is not set:
  39. message "{@P} Teams are currently disabled."
  40. else if {teams} is true:
  41. message "{@P} Teams are currently enabled."
  42. message "{@P} List of all commands:"
  43. message "{@S} /team create"
  44. message "{@S} /team invite"
  45. message "{@S} /team accept"
  46. message "{@S} /team deny"
  47. message "{@S} /team leave"
  48. message "{@S} /team list"
  49. command "/playsound note.harp %command sender% ~ ~ ~ 1 1 1"
  50.  
  51.  
  52. else if arg-1 is "create":
  53. if {teams} is true:
  54. if {inteam::%command sender%} is set:
  55. message "{@P} You are already on a team!"
  56. message "{@S} /team leave"
  57. else if {inteam::%command sender%} is not set:
  58. add 1 to {totalteams}
  59. command "/tm create %{totalteams}%"
  60. message "{@P} You have created your team!"
  61. command "/tm join %{totalteams}% %command sender%"
  62. set {inteam::%command sender%} to true
  63. set {captain::%command sender%} to true
  64. set {tn::%command sender%} to {totalteams}
  65. else if {teams} is not set:
  66. message "{@P} Teams are disabled!"
  67. command "/playsound random.break %command sender% ~ ~ ~ 1 1 1"
  68.  
  69.  
  70. else if arg-1 is "leave":
  71. if {teams} is true:
  72. if {inteam::%command sender%} is set:
  73. command "/tm leave %command sender%"
  74. delete {captain::%command sender%}
  75. message "{@P} You have left your team."
  76. delete {inteam::%command sender%}
  77. delete {tn::%command sender%}
  78. else if {inteam::%command sender%} is not set:
  79. message "{@P} You are not on a team!"
  80. else if {teams} is not set:
  81. message "{@P} Teams are disabled!"
  82.  
  83.  
  84. else if arg-1 is "reset":
  85. if command sender is op:
  86. command "/tm reset"
  87. broadcast "{@P} All teams have been reset."
  88. delete {totalteams}
  89. delete {inteam::*}
  90. delete {pendingteam::*}
  91. delete {pending::*}
  92. delete {teamleader::*}
  93. delete {captain::*}
  94. delete {tn::*}
  95. delete {teamnumber::*}
  96. else if command sender is not op:
  97. message "&7&LYou don't have the correct permissions!"
  98.  
  99.  
  100. else if arg-1 is "invite":
  101. if {teams} is true:
  102. if {captain::%command sender%} is true:
  103. if {inteam::%arg-2%} is set:
  104. message "{@P}{@H} %arg-2%{@C} is already on a team!"
  105. else if {pending::%arg-2%} is set:
  106. message "{@P}{@H} %arg-2%{@C} already has a pending invite!"
  107. else if {pending::%arg-2%} is not set:
  108. set {pending::%arg-2%} to true
  109. set {teamnumber::%arg-2%} to {tn::%command sender%}
  110. set {_TeamNumber} to {Teams.InTeam::%command sender%}
  111. loop {Team.%{_TeamNumber}%::*}:
  112. set {_TeamPlayer} to ("%loop-value-1%" parsed as offlineplayer)
  113. if {_TeamPlayer} is online:
  114. message "{@P} %arg-2% was invited to your team." to {_TeamPlayer}
  115. message "{@P} %command sender% has invited you to their team!" to arg-2
  116. message " {@S}- &b/team accept &7or &b/team deny" to arg-2
  117. else if {captain::%command sender%} is not set:
  118. message "{@P} You are not the team captain!"
  119. else if {teams} is not set:
  120. message "{@P} Teams are disabled!"
  121.  
  122.  
  123. else if arg-1 is "accept":
  124. if {teams} is true:
  125. if {pending::%command sender%} is set:
  126. delete {pending::%command sender%}
  127. set {inteam::%command sender%} to true
  128. command "/tm join %{teamnumber::%command sender%}% %command sender%"
  129. message "{@P} You have joined the team!"
  130. else if {pending::%command sender%} is not set:
  131. message "{@P} You have no pending invites!"
  132. else if {teams} is not set:
  133. message "{@P} Teams are disabled!"
  134.  
  135.  
  136. else if arg-1 is "deny":
  137. if {teams} is true:
  138. if {pending::%command sender%} is set:
  139. delete {pending::%command sender%}
  140. delete {tn::%command sender%}
  141. set {_TeamNumber} to {teamnumber::%command sender%}
  142. delete {teamnumber::%command sender%}
  143. loop {Team.%{_TeamNumber}%::*}:
  144. set {_TeamPlayer} to ("%loop-value-1%" parsed as offlineplayer)
  145. if {_TeamPlayer} is online:
  146. message "{@P} &7%command sender% has denied the invite." to {_TeamPlayer}
  147. message "{@P} You have denied the team request!"
  148. else if {pending::%command sender%} is not set:
  149. message "{@P} You have no pending invites!"
  150. else if {teams} are not set:
  151. message "{@P} Teams are disabled!"
  152.  
  153.  
  154. else if arg-1 is "list":
  155. if {teams} is true:
  156. if {inteam::%command sender%} is set:
  157. message "{@P} Listing your current team members:"
  158. set {_Player} to command sender
  159. set {_TeamNumber} to {Teams.InTeam::%command sender%}
  160. loop {Team.%{_TeamNumber}%::*}:
  161. message " &7- &b%loop-value%" to command sender
  162. else:
  163. message "{@P} You are not in a team!"
  164. else if {teams} are not set:
  165. message "{@P} Teams are disabled!"
  166.  
  167. #----------------------------------------------------------------------------------------------------------------------------------
  168.  
  169. command /tm [<text>] [<text>] [<text>] [<text>] [<text>]:
  170. trigger:
  171.  
  172. if arg 1 is not set:
  173. command sender command "/tm help"
  174.  
  175. else if arg 1 is equal to "help":
  176. if command sender does not have the permission "teams.help":
  177. message "{@P} &4You don't have the correct permissions!"
  178. else:
  179. message "{@P} Listing all commands."
  180. message "{@S}- /tm list &a- &6Lists all current teams"
  181. message "{@S}- /tm create &a- &6Create a team"
  182. message "{@S}- /tm delete &a- &6Delete Team"
  183. message "{@S}- /tm join &a- &6Put <player> in Team"
  184. message "{@S}- /tm leave &a- &6Remove <player> from Team"
  185. message "{@S}- /tm color &a- &6Color all teams at once"
  186. message "{@S}- /tm uncolor &a- &6Remove all colors from teams"
  187. message "{@S}- /tm rebuild &a- &6Rebuild teams, skip empty"
  188. message "{@S}- /tm random <size> <amount> [extend] &a- &6Create Random Teams"
  189. message "{@S}- /tm reset &a- &6Reset all teams"
  190.  
  191. else if arg 1 is equal to "list":
  192. if {Teams::*} is not set:
  193. message "{@P} No teams defined."
  194. else:
  195. loop {Teams::*}:
  196. message "&bTeam %loop-value%&a:"
  197. loop {Team.%loop-value%::*}:
  198. message "&b&l- &c&o%loop-value-2%"
  199.  
  200. else if arg 1 is equal to "create":
  201. if command sender does not have the permission "teams.create":
  202. message "{@P} &4You don't have the correct permissions!"
  203. else if arg 2 is not set:
  204. message "{@P} {@IS}"
  205. else if arg 3 is set:
  206. message "{@P} {@IS}"
  207. else:
  208. set {_TeamNumber} to ("%arg 2%" parsed as integer)
  209. if {_TeamNumber} is not set:
  210. message "{@P} {@IS}"
  211. else if {_TeamNumber} is smaller than 1:
  212. message "{@P} Invalid Team Number!"
  213. else if {Teams::%{_TeamNumber}%} is set:
  214. message "{@P} That team already exists."
  215. else:
  216. set {Teams::%{_TeamNumber}%} to {_TeamNumber}
  217. command "/scoreboard teams add UHC%{_TeamNumber}%"
  218. message "{@P} &7Team %{_TeamNumber}% successfully created."
  219.  
  220. else if arg 1 is equal to "delete":
  221. if command sender does not have the permission "teams.delete":
  222. message "{@P} &4You don't have the correct permissions!"
  223. else if arg 2 is not set:
  224. message "{@P} {@IS}"
  225. else if arg 3 is set:
  226. message "{@P} {@IS}"
  227. else:
  228. set {_TeamNumber} to ("%arg 2%" parsed as integer)
  229. if {_TeamNumber} is not set:
  230. message "{@P} {@IS}"
  231. else if {_TeamNumber} is smaller than 1:
  232. message "{@P} Invalid Team Number!"
  233. else if {Teams::%{_TeamNumber}%} is not set:
  234. message "{@P} Team not found!"
  235. else:
  236. delete {Teams::%{_TeamNumber}%}
  237. loop {Team.%{_TeamNumber}%::*}:
  238. message "{@P} Your team was deleted." to ("%loop-value%" parsed as offlineplayer)
  239. delete {Teams.InTeam::%loop-value%}
  240. delete {Team.%{_TeamNumber}%::*}
  241. command "/scoreboard teams remove UHC%{_TeamNumber}%"
  242.  
  243. message "{@P} Deleted Team &a%{_TeamNumber}%"
  244.  
  245. else if arg 1 is equal to "join":
  246. if command sender does not have the permission "teams.join":
  247. message "{@P} &4You don't have the correct permissions!"
  248. else if arg 2 is not set:
  249. message "{@P} {@IS}"
  250. else if arg 4 is set:
  251. message "{@P} {@IS}"
  252. else:
  253. set {_TeamNumber} to ("%arg 2%" parsed as integer)
  254. if {_TeamNumber} is not set:
  255. message "{@P} {@IS}"
  256. else if {_TeamNumber} is smaller than 1:
  257. message "{@P} Invalid Team Number!"
  258. else if {Teams::%{_TeamNumber}%} is not set:
  259. message "{@P} Team does not exist!"
  260. else:
  261. if arg 3 is not set:
  262. if command sender is console:
  263. message "{@P} {@IS}"
  264. stop
  265. set {_Player} to (name of command sender)
  266. else:
  267. set {_Player} to arg 3
  268. if {Teams.InTeam::%{_Player}%} is set:
  269. message "{@P} Player %{_Player}% is already in a team!"
  270. else:
  271. loop {Team.%{_TeamNumber}%::*}:
  272. set {_TeamPlayer} to ("%loop-value-1%" parsed as offlineplayer)
  273. if {_TeamPlayer} is online:
  274. message "{@P} &d&L%{_Player}% &7has joined your team." to {_TeamPlayer}
  275. set {Teams.InTeam::%{_Player}%} to {_TeamNumber}
  276. add {_Player} to {Team.%{_TeamNumber}%::*}
  277. command "/scoreboard teams join UHC%{_TeamNumber}% %{_Player}%"
  278.  
  279. else if arg 1 is equal to "leave":
  280. if command sender does not have the permission "teams.leave":
  281. message "{@P} &4You don't have the correct permissions!"
  282. else if arg 3 is set:
  283. message "{@P} {@IS}"
  284. else:
  285. if arg 2 is not set:
  286. if command sender is console:
  287. message "{@P} {@IS}"
  288. stop
  289. set {_Player} to (name of command sender)
  290. else:
  291. set {_Player} to arg 2
  292. if {Teams.InTeam::%{_Player}%} is not set:
  293. message "{@P} Player %{_Player}% is not in a team!"
  294. else:
  295. set {_TeamNumber} to {Teams.InTeam::%{_Player}%}
  296. delete {Teams.InTeam::%{_Player}%}
  297. remove {_Player} from {Team.%{_TeamNumber}%::*}
  298. command "/scoreboard teams leave %{_Player}%"
  299. loop {Team.%{_TeamNumber}%::*}:
  300. set {_TeamPlayer} to ("%loop-value-1%" parsed as offlineplayer)
  301. if {_TeamPlayer} is online:
  302. message "{@P} &d&L%{_Player}% &7was kicked from your team." to {_TeamPlayer}
  303.  
  304. else if arg 1 is equal to "color":
  305. if command sender does not have the permission "teams.color":
  306. message "{@P} &4You don't have the correct permissions!"
  307. else if arg 2 is set:
  308. message "{@P} {@IS}"
  309. else if {Teams::*} is not set:
  310. message "{@P} No teams to color!"
  311. else if (size of {Teams::*}) is bigger than 90:
  312. message "{@P} Too many teams to color!"
  313. else:
  314. if (size of {Teams::*}) is smaller than 16:
  315. set {_Colors::*} to "aqua", "black", "blue", "dark_aqua", "dark_blue", "dark_gray", "dark_green", "dark_purple", "dark_red", "gold", "gray", "green", "light_purple", "red" and "yellow"
  316. else if (size of {Teams::*}) is smaller than 20:
  317. set {_Colors::*} to "aqua", "black", "blue", "bold", "dark_aqua", "dark_blue", "dark_gray", "dark_green", "dark_purple", "dark_red", "gold", "gray", "green", "italic", "light_purple", "red", "strikethrough", "underline" and "yellow"
  318. else if (size of {Teams::*}) is equal to 20:
  319. set {_Colors::*} to "aqua", "black", "blue", "bold", "dark_aqua", "dark_blue", "dark_gray", "dark_green", "dark_purple", "dark_red", "gold", "gray", "green", "italic", "light_purple", "red", "strikethrough", "underline", "white" and "yellow"
  320. else:
  321. set {_Colors::*} to "aqua", "black", "blue", "bold", "dark_aqua", "dark_blue", "dark_gray", "dark_green", "dark_purple", "dark_red", "gold", "gray", "green", "italic", "light_purple", "red", "strikethrough", "underline", "white", and "yellow"
  322. set {_Other.Colors::*} to "aqua", "black", "blue", "dark_aqua", "dark_blue", "dark_gray", "dark_green", "dark_purple", "dark_red", "gold", "gray", "green", "light_purple", "red", and "yellow"
  323. set {_Format.Codes::*} to "bold", "italic", "strikethrough", and "underline"
  324. loop {Teams::*}:
  325. if loop-value is less than or equal to 21:
  326. set {_Color} to (random element out of {_Colors::*})
  327. remove {_Color} from {_Colors::*}
  328. command "/scoreboard teams option UHC%loop-value% color %{_Color}%"
  329. replace all "_" with " " in {_Color}
  330. loop {Team.%loop-value%::*}:
  331. message "{@P} Your team color is <%{_Color}%>%{_Color}%!" to ("%loop-value-2%" parsed as offlineplayer)
  332. else:
  333. delete {_Colors::*}
  334. set {_Color} to (random element out of {_Other.Colors::*})
  335. set {_Format} to (random element out of {_Format.Codes::*})
  336. remove {_Color} from {_Other.Colors::*}
  337. command "/scoreboard teams option UHC%loop-value% color %{_Color}%"
  338. replace all "_" with " " in {_Color}
  339. loop {Team.%loop-value%::*}:
  340. message "{@P} Your team color is <%{_Color}%><%{_Format}%>%{_Format}% %{_Color}%!" to ("%loop-value-2%" parsed as offlineplayer)
  341. execute console command "/%{_Format}% UHC%loop-value%"
  342.  
  343. message "{@P} All teams have been colored!"
  344.  
  345. else if arg 1 is equal to "uncolor":
  346. if command sender does not have the permission "teams.uncolor":
  347. message "{@P} &4You don't have the correct permissions!"
  348. else if arg 2 is set:
  349. message "{@P} {@IS}"
  350. else if {Teams::*} is not set:
  351. message "{@P} No teams found!"
  352. else:
  353. loop {Teams::*}:
  354. command "/scoreboard teams option UHC%loop-value% color reset"
  355. loop {Team.%loop-value%::*}:
  356. message "{@P} Your color was removed." to ("%loop-value-2%" parsed as offlineplayer)
  357.  
  358. message "{@P} Uncolored all teams"
  359. loop all players:
  360. loop-player has the permission "teams.uncolor.notify"
  361. loop-player is not command sender
  362. message "{@P} {@N} Uncolored all teams" to loop-player
  363.  
  364. else if arg 1 is equal to "rebuild":
  365. if command sender does not have the permission "teams.rebuild":
  366. message "{@P} &4You don't have the correct permissions!"
  367. else if arg 2 is set:
  368. message "{@P} {@IS}"
  369. else:
  370. set {_TeamCount} to 0
  371. delete {Teams.InTeam::*}
  372. loop {Teams::*}:
  373. if (size of {Team.%loop-value%::*}) is not equal to 0:
  374. message "%loop-value%"
  375. set {_TeamCount} to {_TeamCount}+1
  376. set {_New.Team.%{_TeamCount}%::*} to {Team.%loop-value%::*}
  377. set {_New.Teams::%{_TeamCount}%} to {_TeamCount}
  378. delete {Team.%loop-value%::*}
  379. command "/scoreboard teams remove UHC%loop-value%"
  380. delete {Teams::*}
  381. set {Teams::*} to {_New.Teams::*}
  382. loop {Teams::*}:
  383. command "/scoreboard teams add UHC%loop-value%"
  384. set {Team.%loop-value%::*} to {_New.Team.%loop-value%::*}
  385. loop {Team.%loop-value%::*}:
  386. set {Teams.InTeam::%loop-value-2%} to loop-value-1
  387. command "/scoreboard teams join UHC%loop-value-1% %loop-value-2%"
  388. message "{@P} Teams rebuilt."
  389. loop all players:
  390. loop-player has the permission "teams.rebuild.notify"
  391. loop-player is not command sender
  392. message "{@P} {@N} Rebuilt teams." to loop-player
  393.  
  394.  
  395.  
  396. else if arg 1 is equal to "random":
  397. if command sender does not have the permission "teams.random":
  398. message "{@P} &4You don't have the correct permissions!"
  399. else if arg 2 is not set:
  400. message "{@P} {@IS}"
  401. else if arg 3 is not set:
  402. message "{@P} {@IS}"
  403. else:
  404. set {_TeamSize} to ("%arg 2%" parsed as integer)
  405. set {_TeamAmount} to ("%arg 3%" parsed as integer)
  406. if {_TeamSize} is not set:
  407. message "{@P} {@IS}"
  408. else if {_TeamAmount} is not set:
  409. message "{@P} {@IS}"
  410. else if {_TeamSize} is less than 1:
  411. message "{@P} {@IS}"
  412. else if {_TeamAmount} is less than 1:
  413. message "{@P} {@IS}"
  414. else:
  415. loop all players:
  416. {Teams.InTeam::%loop-player%} is not set
  417. add (name of loop-player) to {_Players::*}
  418. if ({_TeamSize}*{_TeamAmount}) is not equal to (size of {_Players::*}):
  419. message "{@P} The amount of people does not match."
  420. else:
  421. loop {Teams::*}:
  422. command "/scoreboard teams remove UHC%loop-value%"
  423. delete {Team.%loop-value%::*}
  424. delete {Teams.InTeam::*}
  425. delete {Teams::*}
  426. broadcast "{@P} Randomizing teams!"
  427. broadcast " {@S}&7- &b%arg-3% &teams of %arg-2%!"
  428. loop all players:
  429. command "/playsound note.harp %loop-player%"
  430. wait 10 ticks
  431. loop {_TeamAmount} times:
  432. command "/scoreboard teams add UHC%loop-number%"
  433. set {Teams::%loop-number%} to loop-number
  434. loop {_TeamSize} times:
  435. set {_Player} to (random element out of {_Players::*})
  436. remove {_Player} from {_Players::*}
  437. command "/scoreboard teams join UHC%loop-number-1% %{_Player}%"
  438. add {_Player} to {Team.%loop-number-1%::*}
  439. set {Teams.InTeam::%{_Player}%} to loop-number-1
  440. loop {Teams::*}:
  441. loop {Team.%loop-value%::*}:
  442. set {_Player} to ("%loop-value-2%" parsed as offlineplayer)
  443. if {_Player} is online:
  444. message "{@P} &aYour team is:" to {_Player}
  445. loop {Team.%loop-value-1%::*}:
  446. loop-value-3 is not equal to loop-value-2
  447. message "&c%loop-value-3%" to {_Player}
  448. if arg 4 is set:
  449. if arg 4 is equal to "extend":
  450. set {_Extend} to true
  451. if {_Extend} is not set:
  452. broadcast "{@P} &bTeams are randomized!"
  453. else:
  454. broadcast "{@P} &bTeams are randomized!"
  455. loop all players:
  456. command "/playsound random.explode %loop-player%"
  457.  
  458.  
  459. else if arg 1 is equal to "reset":
  460. if command sender does not have the permission "teams.reset":
  461. message "{@P} &4You don't have the correct permissions!"
  462. else if arg 2 is set:
  463. message "{@P} {@IS}"
  464. else:
  465. loop {Teams::*}:
  466. command "/scoreboard teams remove UHC%loop-value%"
  467. delete {Team.%loop-value%::*}
  468. delete {Teams::*}
  469. delete {Teams.InTeam::*}
  470.  
  471. else:
  472. command sender command "/tm help"
  473.  
  474.  
  475.  
  476. #----------------------------------------------------------------------------------------------------------------------------------
  477.  
  478. command /pm <text>:
  479. executable by: players
  480. trigger:
  481. if {Teams.InTeam::%command sender%} is not set:
  482. message "{@P} Team not found."
  483. else:
  484. set {_Team} to {Teams.InTeam::%command sender%}
  485. loop all players:
  486. if {Teams.InTeam::%loop-player%} is equal to {_Team}:
  487. message "&7[&aTeamChat&7] &b%command sender%&a: &7%arg 1%" to loop-player
  488. else if {PMSocialSpy::%loop-player%} is true:
  489. message "&7[&aPMS&7] &7[&b%{_Team}%&7] &7&o%command sender%&b: &r%arg 1%" to loop-player
  490.  
  491. command /pms:
  492. permission: skript.pm.socialspy
  493. trigger:
  494. if {PMSocialSpy::%command sender%} is not set:
  495. set {PMSocialSpy::%command sender%} to true
  496. message "&6Team Social Spy is now &a&Lenabled&6."
  497. else:
  498. delete {PMSocialSpy::%command sender%}
  499. message "&6Team Social Spy is now &c&ldisabled&6."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement