Zeldaboy111

GUNS KLAAR ]|[ Skript #293

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