Advertisement
kama6012

test

Mar 18th, 2022
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. function setItemTag(item: item, tag: string, value: object) :: item:
  2. set {_nbt} to nbt compound of {_item}
  3. set tag "tag;custom;%{_tag}%" of {_nbt} to {_value}
  4. return item from nbt {_nbt}
  5.  
  6. function getItemTag(item: item, tag: string) :: object:
  7. set {_tag} to tag {_tag} of nbt of {_item}
  8. return {_tag}
  9.  
  10. function removeItemTag(item: item, tag: string) :: item:
  11. set {_nbt} to nbt compound of {_item}
  12. delete tag "tag;custom;%{_tag}%" of {_nbt}
  13. return item from nbt {_nbt}
  14.  
  15.  
  16. on quit:
  17. delete {gun::reloading::%player%}
  18.  
  19. command /getgun:
  20. trigger:
  21. give player unbreakable bow named "&bGlock18" damaged by 1 with nbt "{AttributeModifiers:[{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-100,Operation:1,UUIDLeast:721714,UUIDMost:528221,Slot:""mainhand""}]}"
  22.  
  23. command /checknbt:
  24. trigger:
  25. message "%nbt compound of player's tool%" to player
  26.  
  27. command /clip [<integer=1>]:
  28. trigger:
  29. give arg-1 of spruce door item named "&cAmmo Clip" to player
  30.  
  31. on right click:
  32. remove all arrow from player's inventory
  33. if name of player's tool contains "&bGlock18":
  34. cancel event
  35. {gun::reloading::%player%} is not true
  36. set {_ammunition} to getItemTag(player's tool, "ammunition")
  37. if {_ammunition} is "ammunition":
  38. set player's tool to setItemTag(player's tool, "ammunition", 17)
  39. set {_ammunition} to getItemTag(player's tool, "ammunition")
  40. if {_ammunition} is more than 0:
  41. shoot arrow from player at speed 4.5
  42. set damage of player's tool to 2
  43. add "Guntype: Glock18" to the scoreboard tags of shot arrow
  44. play sound "entity.generic.explode" from master category at volume 0.35 with pitch 2 at player's location
  45. set player's tool to setItemTag(player's tool, "ammunition", {_ammunition}-1)
  46. send action bar "&c%{_ammunition}-1% &8/ &a17" to player
  47. wait 1 tick
  48. set damage of player's tool to 1
  49. else:
  50. reload(player)
  51.  
  52. on drop of bow:
  53. if name of event-item contains "&bGlock18":
  54. cancel event
  55. wait 1 tick
  56. reload(player)
  57.  
  58. on projectile hit:
  59. delete the projectile
  60.  
  61. on entity knockback:
  62. cancel event
  63.  
  64. on damage:
  65. set no damage tick of victim to 0
  66. if scoreboard tags of event-projectile contains "Guntype":
  67. loop scoreboard tags of event-projectile:
  68. loop-value contains "Guntype:"
  69. set {_temp::*} to loop-value parsed as "Guntype: %text%"
  70. set {_guntype} to {_temp::1}
  71. push victim event-projectile's velocity at speed 0.5
  72.  
  73. function reload(player: player):
  74. if name of {_player}'s tool contains "&bGlock18":
  75. set {_tool} to tool of {_player}
  76. set {_ammunition} to getItemTag({_player}'s tool, "ammunition")
  77. if {_ammunition} is less than 31:
  78. if {_player} has spruce door item named "&cAmmo Clip":
  79. if {gun::reloading::%{_player}%} is not true:
  80. send action bar "&eRELOADING..." to {_player}
  81. set {gun::reloading::%{_player}%} to true
  82. remove 1 spruce door item named "&cAmmo Clip" from {_player}'s inventory
  83. set damage of {_player}'s tool to 3
  84. set {_tool} to tool of {_player}
  85. play sound "block.wooden_door.open" from master category with pitch 2 at {_player}'s location
  86. if tool of {_player} is {_tool}:
  87. wait 2 seconds
  88. play sound "block.wooden_door.close" from master category with pitch 2 at {_player}'s location
  89. if tool of {_player} is {_tool}:
  90. wait 8 ticks
  91. play sound "block.wooden_door.close" from master category with pitch 2 at {_player}'s location
  92. set {_player}'s tool to setItemTag({_player}'s tool, "ammunition", 17)
  93. send action bar "&aRELOAD COMPLETE" to {_player}
  94. delete {gun::reloading::%{_player}%}
  95. set damage of {_player}'s tool to 1
  96. else:
  97. give {_player} spruce door item named "&cAmmo Clip"
  98. send action bar "&cRELOAD CANCELED" to {_player}
  99. delete {gun::reloading::%{_player}%}
  100. else:
  101. give {_player} spruce door named "&cAmmo Clip"
  102. send action bar "&cRELOAD CANCELED" to {_player}
  103. delete {gun::reloading::%{_player}%}
  104. else:
  105. send action bar "&eYOU DO NOT HAVE AN AMMUNITION CLIP" to {_player}
  106. else:
  107. send action bar "&eYOUR WEAPON IS RELOADED ALREADY" to {_player}
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement