Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setItemTag(item: item, tag: string, value: object) :: item:
- set {_nbt} to nbt compound of {_item}
- set tag "tag;custom;%{_tag}%" of {_nbt} to {_value}
- return item from nbt {_nbt}
- function getItemTag(item: item, tag: string) :: object:
- set {_tag} to tag {_tag} of nbt of {_item}
- return {_tag}
- function removeItemTag(item: item, tag: string) :: item:
- set {_nbt} to nbt compound of {_item}
- delete tag "tag;custom;%{_tag}%" of {_nbt}
- return item from nbt {_nbt}
- on quit:
- delete {gun::reloading::%player%}
- command /getgun:
- trigger:
- 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""}]}"
- command /checknbt:
- trigger:
- message "%nbt compound of player's tool%" to player
- command /clip [<integer=1>]:
- trigger:
- give arg-1 of spruce door item named "&cAmmo Clip" to player
- on right click:
- remove all arrow from player's inventory
- if name of player's tool contains "&bGlock18":
- cancel event
- {gun::reloading::%player%} is not true
- set {_ammunition} to getItemTag(player's tool, "ammunition")
- if {_ammunition} is "ammunition":
- set player's tool to setItemTag(player's tool, "ammunition", 17)
- set {_ammunition} to getItemTag(player's tool, "ammunition")
- if {_ammunition} is more than 0:
- shoot arrow from player at speed 4.5
- set damage of player's tool to 2
- add "Guntype: Glock18" to the scoreboard tags of shot arrow
- play sound "entity.generic.explode" from master category at volume 0.35 with pitch 2 at player's location
- set player's tool to setItemTag(player's tool, "ammunition", {_ammunition}-1)
- send action bar "&c%{_ammunition}-1% &8/ &a17" to player
- wait 1 tick
- set damage of player's tool to 1
- else:
- reload(player)
- on drop of bow:
- if name of event-item contains "&bGlock18":
- cancel event
- wait 1 tick
- reload(player)
- on projectile hit:
- delete the projectile
- on entity knockback:
- cancel event
- on damage:
- set no damage tick of victim to 0
- if scoreboard tags of event-projectile contains "Guntype":
- loop scoreboard tags of event-projectile:
- loop-value contains "Guntype:"
- set {_temp::*} to loop-value parsed as "Guntype: %text%"
- set {_guntype} to {_temp::1}
- push victim event-projectile's velocity at speed 0.5
- function reload(player: player):
- if name of {_player}'s tool contains "&bGlock18":
- set {_tool} to tool of {_player}
- set {_ammunition} to getItemTag({_player}'s tool, "ammunition")
- if {_ammunition} is less than 31:
- if {_player} has spruce door item named "&cAmmo Clip":
- if {gun::reloading::%{_player}%} is not true:
- send action bar "&eRELOADING..." to {_player}
- set {gun::reloading::%{_player}%} to true
- remove 1 spruce door item named "&cAmmo Clip" from {_player}'s inventory
- set damage of {_player}'s tool to 3
- set {_tool} to tool of {_player}
- play sound "block.wooden_door.open" from master category with pitch 2 at {_player}'s location
- if tool of {_player} is {_tool}:
- wait 2 seconds
- play sound "block.wooden_door.close" from master category with pitch 2 at {_player}'s location
- if tool of {_player} is {_tool}:
- wait 8 ticks
- play sound "block.wooden_door.close" from master category with pitch 2 at {_player}'s location
- set {_player}'s tool to setItemTag({_player}'s tool, "ammunition", 17)
- send action bar "&aRELOAD COMPLETE" to {_player}
- delete {gun::reloading::%{_player}%}
- set damage of {_player}'s tool to 1
- else:
- give {_player} spruce door item named "&cAmmo Clip"
- send action bar "&cRELOAD CANCELED" to {_player}
- delete {gun::reloading::%{_player}%}
- else:
- give {_player} spruce door named "&cAmmo Clip"
- send action bar "&cRELOAD CANCELED" to {_player}
- delete {gun::reloading::%{_player}%}
- else:
- send action bar "&eYOU DO NOT HAVE AN AMMUNITION CLIP" to {_player}
- else:
- send action bar "&eYOUR WEAPON IS RELOADED ALREADY" to {_player}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement