Tarna256

kit skript

Jul 8th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.69 KB | None | 0 0
  1. #
  2. # Essentials Kits (made by Austin collaborating with Lupusor)
  3. #
  4.  
  5. # Known Bug
  6. # when using the /createkit there is a bug ever so often where it sends "An internal error occurred"
  7. # it's an issue with timespam mainly just add/remove the (s) in the cooldown part (this issue can also be seen for [1 minute and 5 seconds]
  8. # EX: /createkit example 1 minute
  9. # EX: /createkit example 1 minutes
  10. #
  11. # PERMISSIONS:
  12. # easykits.createkit
  13. # easykits.deletekit
  14. # easykits.kit.(kit)
  15. # easykits.createkit
  16. # easykits.createsigns
  17. #
  18. # COMMANDS:
  19. # /previewkit (kit) | preview a kit on the server | no permission needed
  20. # /kit (kit) | select a kit you own | no permission needed
  21. # /kits | list all kits you own with an unlimited page gui | no permission needed
  22. # /deletekit (kit) | delete a kit you don't want from the server | easykits.deletekit
  23. # /createkit (kit) (timespan) | create a kit you for the server | easykits.createkit
  24. # EX: /createkit example 1 second
  25. # EX: /createkit example 0 seconds
  26. # EX: /createkit example 5 minutes and 5 seconds
  27. #
  28. # SIGNS:
  29. # on any sign put [PREVIEW KIT] or [SELECT KIT] on line 1
  30. # and on line 2 put the kit you'd like to preview/select
  31. # these usages are great for people who own a kit pvp server
  32.  
  33.  
  34.  
  35. #
  36. # Functions (Do not edit without knowing how)
  37. #
  38.  
  39. options:
  40. drop_when_full: true # true or false | yes or no
  41.  
  42.  
  43. function previewKit(p: player, kit: text):
  44. {EasyKits::*} contains {_kit}
  45. set metadata value "gui" of {_p} to "kitpreview"
  46. set {_inv} to chest inventory with 5 rows named "Previewing Kit | %{_kit}%"
  47. loop {EasyKits::%{_kit}%::items::*}:
  48. set {_id} to (((loop-index) parsed as integer)-1)
  49. {_id} < 36
  50. set {_slot} to {_id}+27 if {_id} < 9 else {_id}-9
  51. set slot {_slot} of {_inv} to loop-value
  52. set slot (integers from 36 to 44) of {_inv} to black stained glass pane
  53. set slot 40 of {_inv} to paper named "&3Inventory View Information" with lore "&7Line 1", "&7Line 2", "&7Line 3" and "&bHot-Bar"
  54. open {_inv} to {_p}
  55.  
  56. function listKits(p: player, page: number):
  57. set metadata value "gui" of {_p} to "kitlist"
  58. set metadata value "guidata" of {_p} to {_page}
  59. set {_kits::*} to {EasyKits::*} where [{_p} has permission "easykits.kit.%input%"]
  60. set {_inv} to chest inventory with 6 rows named "Kits | Total: %size of {_kits::*}% | Page: %({_page})+1%"
  61. set {_startPoint} to {_page}*36
  62. set {_slot} to 9
  63. loop {_kits::*}:
  64. ((loop-index) parsed as integer) > {_startPoint}
  65. set slot {_slot} of {_inv} to paper named "&e%loop-value%" with lore "&7Cooldown: &f%{EasyKits::%loop-value%::cooldown}%" and "&7Permission: &fEasyKits.kit.%loop-value%", "" and "&7&l| &fRight Click to Preview"
  66. add 1 to {_slot}
  67. {_slot} = 45
  68. exit loop
  69. if (size of {_kits::*}) > (({_startPoint})+36):
  70. set slot 53 of {_inv} to arrow named "&eNext Page"
  71. if {_page} > 0:
  72. set slot 45 of {_inv} to arrow named "&ePrevious Page"
  73. open {_inv} to {_p}
  74.  
  75. function selectKit(p: player, kit: text):
  76. {EasyKits::*} contains {_kit}
  77. {_p} has permission "easykits.kit.%{_kit}%"
  78. set {_uuid} to uuid of {_p}
  79. set {_now} to now
  80. set {_lastUsed} to {KitData::%{_uuid}%::%{_kit}%} otherwise now
  81. set {_cooldown} to {EasyKits::%{_kit}%::cooldown}
  82. send "&cYou still need to wait &4%difference between {_lastUsed} and {_now}%" to {_p} where [{_now} < {_lastUsed}]
  83. {_now} >= {_lastUsed}
  84. set {KitData::%{_uuid}%} to {_uuid}
  85. set {KitData::%{_uuid}%::%{_kit}%} to {_cooldown} from now
  86. loop {EasyKits::%{_kit}%::items::*}:
  87. loop-value is not air
  88. add loop-value to {_p}'s inventory where [{_p} can hold loop-value]
  89. {@drop_when_full} is true or yes
  90. drop loop-value above {_p}'s location where [{_p} can't hold loop-value]
  91. send "&aYou've used the kit &2%{_kit}%" to {_p}
  92.  
  93.  
  94. #
  95. # Message Options
  96. #
  97.  
  98. options:
  99. usage: &c/createkit (name) (cooldown)
  100. noItems: &cYou don't have any items if your inventory
  101. inUse: &cThis kit name already exist
  102. lengthLimit: &cThere is a minimum of 3 characters and a maximum of 8 characters!
  103.  
  104.  
  105. #
  106. # Command Options
  107. #
  108.  
  109. options:
  110. permission: easykits.createkit
  111. permission_message: {@server} &8&l| &cYou don't have the required permission node
  112. cooldown: 0 seconds # when set to 0 this will allow it to be spammed
  113. cooldown_message: {@server} &8&l| &cThis command is currently still on a %remaining time% cooldown
  114. cooldown_bypass: skript.admin
  115.  
  116. command /createkit [<text>] [<timespan>]:
  117. permission: {@permission}
  118. permission message: {@permission_message}
  119. cooldown: {@cooldown}
  120. cooldown message: {@cooldown_message}
  121. cooldown bypass: {@cooldown_bypass}
  122. executable by: players
  123. trigger:
  124. if arg 1 or arg 2 is not set:
  125. send "{@usage}"
  126. cancel cooldown
  127. else if (amount of items in player's inventory) = 0:
  128. send "{@noItems}"
  129. cancel cooldown
  130. else if {EasyKits::*} contains arg-1:
  131. send "{@inUse}"
  132. cancel cooldown
  133. else if length of arg-1 > 10:
  134. send "{@lengthLimit}"
  135. cancel cooldown
  136. else if length of arg-1 < 3:
  137. send "{@lengthLimit}"
  138. cancel cooldown
  139. else:
  140. set {EasyKits::%arg-1%} to arg-1
  141. set {EasyKits::%arg-1%::cooldown} to arg-2
  142. loop 36 times:
  143. set {EasyKits::%arg-1%::items::%loop-value%} to slot ((loop-value)-1) of player's inventory
  144. send "&cYou've created the new kit &4%arg-1% &cwith a cooldown of &4%arg-2%"
  145.  
  146. command /previewkit [<text>]:
  147. executable by: players
  148. trigger:
  149. send "&cYou need to define a kit" to player where [arg-1 is not set]
  150. arg-1 is set
  151. send "&4%arg-1% &cdoesn't seem to be a kit" to player where [{EasyKits::*} doesn't contain arg-1]
  152. {EasyKits::*} contains arg-1
  153. previewKit(player, arg-1)
  154.  
  155. command /kit [<text>]:
  156. executable by: players
  157. trigger:
  158. send "&cYou need to define a kit" to player where [arg-1 is not set]
  159. arg-1 is set
  160. send "&4%arg-1% &cdoesn't seem to be a kit" to player where [{EasyKits::*} doesn't contain arg-1]
  161. {EasyKits::*} contains arg-1
  162. send "&cYou don't have the required permission node" to player where [player doesn't have permission "easykits.kit.%arg-1%"]
  163. player has permission "easykits.kit.%arg-1%"
  164. selectKit(player, arg-1)
  165.  
  166. command /kits [<text>]:
  167. executable by: players
  168. trigger:
  169. listKits(player, 0)
  170.  
  171. options:
  172. permission: easykits.deletekit
  173. permission_message: &8&l| &cYou don't have the required permission node
  174. cooldown: 0 seconds # when set to 0 this will allow it to be spammed
  175. cooldown_message: &8&l| &cThis command is currently still on a %remaining time% cooldown
  176. cooldown_bypass: skript.admin
  177.  
  178. command /deletekit [<text>]:
  179. permission: {@permission}
  180. permission message: {@permission_message}
  181. cooldown: {@cooldown}
  182. cooldown message: {@cooldown_message}
  183. cooldown bypass: {@cooldown_bypass}
  184. executable by: players
  185. trigger:
  186. if {EasyKits::*} doesn't contain arg-1:
  187. send "&cThere doesn't seem to be any kit by that name"
  188. else:
  189. delete {EasyKits::%arg-1%::items::*}
  190. delete {EasyKits::%arg-1%::*}
  191. delete {EasyKits::%arg-1%}
  192. send "&cYou've deleted the kit &4%arg-1%"
  193.  
  194. #
  195. # Inventory Management
  196. #
  197.  
  198. on inventory close:
  199. if metadata value "gui" of player is set:
  200. clear metadata "gui" of player
  201. if metadata value "guidata" of player is set:
  202. clear metadata "guidata" of player
  203.  
  204. on quit:
  205. if metadata value "gui" of player is set:
  206. clear metadata "gui" of player
  207. if metadata value "guidata" of player is set:
  208. clear metadata "guidata" of player
  209.  
  210. on inventory click:
  211. if metadata value "gui" of player is "kitpreview":
  212. cancel event
  213. else if metadata value "gui" of player is "kitlist":
  214. cancel event
  215. set {_page} to "%metadata value ""guidata"" of player%" parsed as number
  216. if event-item is a paper:
  217. click type is right mouse button or right mouse button with shift
  218. close player's inventory
  219. previewKit(player, uncolored name of event-item)
  220. else if event-item is a arrow named "&eNext Page":
  221. close player's inventory
  222. listKits(player, {_page}+1)
  223. else if event-item is a arrow named "&ePrevious Page":
  224. close player's inventory
  225. listKits(player, {_page}-1)
  226.  
  227. #
  228. # Sign Stuff
  229. #
  230.  
  231.  
  232. on sign edit:
  233. player has permission "easykits.createsigns"
  234. if uncolored line 1 is "[PREVIEW KIT]":
  235. if line 2 is empty:
  236. set line 1 to "&c[PREVIEW KIT]"
  237. set line 2 to "&4(kit name)"
  238. else if {EasyKits::*} doesn't contain uncolored line 2:
  239. set line 1 to "&c[PREVIEW KIT]"
  240. set line 2 to "&4(kit name)"
  241. else:
  242. set line 1 to "&1[PREVIEW KIT]"
  243. set line 2 to uncolored line 2
  244. else if uncolored line 1 is "[SELECT KIT]":
  245. if line 2 is empty:
  246. set line 1 to "&c[SELECT KIT]"
  247. set line 2 to "&4(kit name)"
  248. else if {EasyKits::*} doesn't contain uncolored line 2:
  249. set line 1 to "&c[SELECT KIT]"
  250. set line 2 to "&4(kit name)"
  251. else:
  252. set line 1 to "&1[SELECT KIT]"
  253. set line 2 to uncolored line 2
  254.  
  255. on right click on any sign:
  256. if colored line 1 of event-block is "&1[PREVIEW KIT]":
  257. previewKit(player, uncolored line 2 of event-block)
  258. else if colored line 1 of event-block is "&1[SELECT KIT]":
  259. selectKit(player, uncolored line 2 of event-block)
  260.  
  261. command /give <item types> to <player>:
  262. permission: skript.give
  263. trigger:
  264. send "{@colour1}Giving {@colour2}%argument 1% {@colour1}to {@colour3}%argument 2%" to player
  265. loop argument 1:
  266. player has permission "skript.give.%loop-item%":
  267. give loop-item to argument 2
  268. send "{@colour1}You recieved {@colour2}%loop-item% {@colour1}from {@colour3}%player%" to argument 2
  269.  
  270. command /giveaway <item types>:
  271. permission: skript.give
  272. trigger:
  273. send "{@colour1}Giving {@colour2}%argument 1% {@colour1}to {@colour3}everyone!" to player
  274. loop argument 1:
  275. player has permission "skript.give.%loop-item%":
  276. give loop-item to all players
  277. send "{@colour1}You recieved {@colour2}%loop-item% {@colour1}from &lGIVEAWAY." to all players
Add Comment
Please, Sign In to add comment