Skript Version: 2.5.3
Skript Author: YourSpeedDealer
Minecraft Version: 1.16.5
Full Code:
No errors whatsoever.
If I were to have two of the same item with the command /m4a1, they would both have the same nbt and name. If I shoot one gun, the {ammo} changes for both of them because it isn't unique to each specific tool. My question being, how can I make each NBT unique to the held item, so that when I shoot from one gun, it doesn't drain {ammo} of the other?
Skript Author: YourSpeedDealer
Minecraft Version: 1.16.5
Full Code:
Code:
command /m4a1:
trigger:
set {_M4A1} to 1 leather horse armor named "&bM4A1"
add "{maxDurabilityM4:31}" to nbt of {_M4A1}
set {ammo} to tag "maxDurabilityM4" of nbt of {_M4A1}
broadcast "%{ammo}%"
give player {_M4A1}
on rightclick:
if name of player's tool contains "&bM4A1":
broadcast "%{ammo}%"
if {kyle::%player%} is true:
cancel event
else:
if {ammo} is greater than 0:
shoot an egg from player's head at speed 4.5
set {bulletegg.%player%} to 1
play sound "entity.generic.explode" from master category at volume 0.35 with pitch 2 at player's location
wait 2 ticks
set {ammo} to {ammo} - 1
send action bar "%{_ammo}% / 31" to player
if {ammo} is equal to 0:
play sound "BLOCK_DISPENSER_DISPENSE" at volume 0.35 with pitch 2 at player's location
cancel event
No errors whatsoever.
If I were to have two of the same item with the command /m4a1, they would both have the same nbt and name. If I shoot one gun, the {ammo} changes for both of them because it isn't unique to each specific tool. My question being, how can I make each NBT unique to the held item, so that when I shoot from one gun, it doesn't drain {ammo} of the other?