Zeldaboy111

Guns toevoegen ]|[ Skript #317

Jun 5th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.08 KB | None | 0 0
  1. #- Reselling/Reuploading while claiming that it is yours or made by you is disallowed
  2. #- Do not edit it and upload it as your own
  3. #- While using it in a video, please feature everything under "Video"
  4. #
  5. #Video:
  6. #Skript made by Zeldaboy111
  7. #More content of the creator: https://forums.skunity.com/search/26443679/
  8.  
  9. options:
  10. logo: &6Guns &8:&7
  11. cLogo: &f[&6Guns&f] &8:&7
  12.  
  13. on enable:
  14. set {guns.list::*} to "pistol", "desert_eagle", "rifle" and "machine_gun"
  15. set {guns.info.names::*} to "&7Pistol", "&7Desert Eagle", "&9Rifle" and "&6Machine Gun"
  16. set {guns.specs.shooting.shotCooldown::*} to "10", "9", "2" and "0.1"
  17. set {guns.specs.shooting.strength::*} to "2", "3", "3" and "1"
  18. set {guns.specs.shooting.range::*} to "16", "19", "22" and "27"
  19. set {guns.specs.reload.speed::*} to "5", "10", "2" and "2"
  20. set {guns.specs.reload.amount::*} to "7", "5", "31" and "40"
  21.  
  22. #========================================
  23. # F U N C T I O N S
  24. #========================================
  25. function getGun(p: Player, gun: String):
  26. loop {guns.list::*}:
  27. if loop-value is {_gun} in lower case:
  28. set {_value} to loop-index
  29. stop loop
  30.  
  31. if {_value} is set:
  32. give {_p} iron horse armor named "%{guns.info.names::%{_value}%}%" with lore "" and "&7Ammo: %{guns.specs.reload.amount::%{_value}%}% / %{guns.specs.reload.amount::%{_value}%}%" without any NBT
  33. send "{@logo} &e%{_gun}% &7given!" to {_p}
  34.  
  35. else:
  36. send "{@logo} The gun &e%{_gun}% &7doesn't exist." to {_p}
  37.  
  38. function selectGun(p: Player):
  39. delete {heldGun.%{_p}%}
  40. delete {heldGun.%{_p}%.index}
  41. set {_name} to name of {_p}'s held item
  42.  
  43. loop {guns.info.names::*}:
  44. if loop-value is {_name}:
  45. set {heldGun.%{_p}%} to {guns.list::%loop-index%}
  46. set {heldGun.%{_p}%.index} to loop-index
  47. stop loop
  48.  
  49.  
  50. function gunInfo(p: Player, gun: String):
  51. send "{@logo} &c&lWIP &8(&7Work In Progress&8)" to {_p}
  52.  
  53. #========================================
  54. # C O M M A N D S
  55. #========================================
  56. command /guns [<text>] [<text>]:
  57. aliases: /gun
  58. trigger:
  59. executor is player:
  60. if player has permission "guns":
  61. if arg-1 is "help":
  62. send "&7&m &7{ &6Guns &7}&m "
  63. send "<cmd:/guns list><ttp:&8Get a list of all the guns>&e/guns list"
  64. send "<sgt:/guns get <gun>><ttp:&8Get a gun>&e/guns get <gun>"
  65. send "<sgt:/guns info [gun]><ttp:&8Get the information [about a gun]>&e/guns info [gun]"
  66. send "&7Tip&8: &7Try hovering over and clicking on the messages!"
  67. send "&7&m &7{ &6Guns &7}&m "
  68.  
  69. else if arg-1 is "list":
  70. send "{@logo} &7Here is a list from all the guns&8:%nl%&epistol&8, &edesert_eagle&8, &erifle&8, &emachine_gun"
  71.  
  72. else if arg-1 is "get":
  73. if arg-2 is set:
  74. getGun(player, arg-2)
  75.  
  76. else:
  77. send "{@logo} &7You need to give up a &egun&7."
  78.  
  79. else if arg-1 is "info":
  80. if arg-2 is set:
  81. gunInfo(player, arg-2)
  82.  
  83. else:
  84. send "{@logo} &7You need to give up a &egun&7."
  85.  
  86. else:
  87. send "{@logo} &7Do &e/guns help &7for more info!"
  88.  
  89. else:
  90. send "{@cLogo} &7This command can only be executed by a player!"
  91.  
  92. on right click with iron horse armor:
  93. if {reloading.%player%} is true:
  94. send "{@logo} You can't shoot whilst reloading!"
  95. stop
  96.  
  97. if {heldGun.%player%} or {heldGun.%player%.index} is not set:
  98. set {_new} to true
  99.  
  100. else if {heldGun.%player%} is not name of player's held item:
  101. set {_new} to true
  102.  
  103. if {_new}:
  104. selectGun(player)
  105.  
  106. if {heldGun.%player%} and {heldGun.%player%.index} is set:
  107. if {lastShoot.%player%} is set:
  108. if difference between {lastShoot.%player%} and now <= "%{guns.specs.shooting.shotCooldown::%{heldGun.%player%.index}%}% ticks" parsed as a timespan:
  109. stop
  110.  
  111.  
  112. set {lastShoot.%player%} to now
  113. set {_lore::*} to lore of player's held item
  114. set {_ammo} to {_lore::2}
  115.  
  116. replace all "&7Ammo: " in {_ammo} with ""
  117. replace all " / %{guns.specs.reload.amount::%{heldGun.%player%.index}%}%" in {_ammo} with ""
  118. set {_ammo} to {_ammo} parsed as a number
  119.  
  120. if {_ammo} < 1:
  121. send "{@logo} You have to reload!"
  122.  
  123. else:
  124. set {_newLore::*} to {_lore::*}
  125. set {_newLore::2} to "&7Ammo: %{_ammo} - 1% / %{guns.specs.reload.amount::%{heldGun.%player%.index}%}%"
  126.  
  127. set lore of player's held item to {_newLore::*}
  128. play raw sound "BLOCK_LEVER_CLICK" at player with pitch 7 volume 10
  129.  
  130. loop {guns.specs.shooting.range::%{heldGun.%player%.index}%} parsed as a number times:
  131. set {_loc} to location 1 meters above and loop-value-0.5 meters in front of player
  132. show 10 "Smoke Normal" particles at {_loc} for player offset by 0.2, 0.2, 0.2
  133. loop all entities in radius 1 meters around {_loc}:
  134. if loop-entity is not player:
  135. damage loop-entity by ({guns.specs.shooting.strength::%{heldGun.%player%.index}%} parsed as a number)
  136.  
  137. on left click with iron horse armor:
  138. wait 1 tick
  139. if {heldGun.%player%} or {heldGun.%player%.index} is not set:
  140. set {_new} to true
  141.  
  142. else if {heldGun.%player%} is not name of player's held item:
  143. set {_new} to true
  144.  
  145. if {_new}:
  146. selectGun(player)
  147.  
  148. if {heldGun.%player%} and {heldGun.%player%.index} is set:
  149. set {_lore::*} to lore of player's held item
  150. set {_ammo} to {_lore::2}
  151.  
  152. if {reloading.%player%} is true:
  153. send "{@logo} You already are reloading!"
  154. stop
  155.  
  156. if {_lore::2} is not "&7Ammo: %{guns.specs.reload.amount.%{heldGun.%player%.index}%}% / %{guns.specs.reload.amount::%{heldGun.%player%.index}%}%":
  157. replace all "&7Ammo: " in {_ammo} with ""
  158. replace all " / %{guns.specs.reload.amount::%{heldGun.%player%.index}%}%" in {_ammo} with ""
  159.  
  160. set {_ammo} to {_ammo} parsed as a number
  161. set {_reload.current} to 0
  162.  
  163. send "{@logo} Reloading..."
  164. set {reloading.%player%} to true
  165. set {heldSlot.%player%} to current hotbar slot of player
  166.  
  167. while {_lore::2} is not "&7Ammo: %{guns.specs.reload.amount::%{heldGun.%player%.index}%}% / %{guns.specs.reload.amount::%{heldGun.%player%.index}%}%":
  168. if {reloading.%player%} is not true:
  169. stop loop
  170.  
  171. if "%{_reload.current}%" = "%{guns.specs.reload.speed::%{heldGun.%player%.index}%}%":
  172. play raw sound "UI_BUTTON_CLICK" at player with pitch 3 volume 10
  173. set {_reload.current} to 0
  174. add 1 to {_ammo}
  175. set {_lore::2} to "&7Ammo: %{_ammo}% / %{guns.specs.reload.amount::%{heldGun.%player%.index}%}%"
  176. set lore of player's held item to {_lore::*}
  177.  
  178. else:
  179. add 1 to {_reload.current}
  180.  
  181. wait 1 tick
  182.  
  183. delete {reloading.%player%}
  184. send "{@logo} Reloaded!"
  185. play raw sound "ENTITY_ITEM_PICKUP" at player with pitch 3 volume 10
  186.  
  187. else:
  188. send "{@logo} You do not have to reload!"
  189.  
  190. every 1 tick:
  191. loop all players:
  192. if {reloading.%loop-player%} is true:
  193. if current hotbar slot of loop-player is not {heldSlot.%loop-player%}:
  194. set current hotbar slot of loop-player to {heldSlot.%loop-player%}
  195.  
  196. on inventory click:
  197. if {reloading.%player%} is true:
  198. cancel event
  199.  
  200.  
  201. on quit:
  202. delete {reloading.%player%}
  203.  
  204. on join:
  205. if {reloading.%player%} is set:
  206. delete {reloading.%player%}
Add Comment
Please, Sign In to add comment