making a lifesteal skript and for some reason it wont let me add back a heart when the item is stacked. below is the full code.
command /withdraw [<number=1>]:
permission: lifesteal.cmd.withdraw
permission message: &8[<##ff7a39>&lLIFESTEAL&8] &cSorry! You do not have permission to use this command.
usage: &cCorrect Usage: /withdraw [number]
description: Withdraw a specific number of hearts, or 1 heart if no number is specified.
trigger:
set {_heartsToWithdraw} to arg-1
if {_heartsToWithdraw} > 10:
send "&8[<##ff7a39>&lLIFESTEAL&8] &cYou can only withdraw up to 10 hearts at a time!" to player
stop
if max health of player > {_heartsToWithdraw} + 9:
if {withdraw.cooldown.%player%} is set:
send "&8[<##ff7a39>&lLIFESTEAL&8] &cYou must wait before using this command again!" to player
else:
loop {_heartsToWithdraw} times:
remove 1 from player's max health
give player 1 poppy named "&cHEART"
send "&8[<##ff7a39>&lLIFESTEAL&8] &aYou have withdrawn %{_heartsToWithdraw}% heart(s) and received them as &cHEART(s) &ain your inventory!" to player
set {withdraw.cooldown.%player%} to true
wait 10 seconds
delete {withdraw.cooldown.%player%}
else:
send "&8[<##ff7a39>&lLIFESTEAL&8] &cYou don't have enough hearts to withdraw %{_heartsToWithdraw}% hearts!" to player
on rightclick:
if player's tool is a poppy named "&cHEART":
add 1 to max health of player
remove 1 of player's tool from the player's inventory
send "&8[<##ff7a39>&lLIFESTEAL&8] &aYou have added 1 heart back to your health!" to player
command /withdraw [<number=1>]:
permission: lifesteal.cmd.withdraw
permission message: &8[<##ff7a39>&lLIFESTEAL&8] &cSorry! You do not have permission to use this command.
usage: &cCorrect Usage: /withdraw [number]
description: Withdraw a specific number of hearts, or 1 heart if no number is specified.
trigger:
set {_heartsToWithdraw} to arg-1
if {_heartsToWithdraw} > 10:
send "&8[<##ff7a39>&lLIFESTEAL&8] &cYou can only withdraw up to 10 hearts at a time!" to player
stop
if max health of player > {_heartsToWithdraw} + 9:
if {withdraw.cooldown.%player%} is set:
send "&8[<##ff7a39>&lLIFESTEAL&8] &cYou must wait before using this command again!" to player
else:
loop {_heartsToWithdraw} times:
remove 1 from player's max health
give player 1 poppy named "&cHEART"
send "&8[<##ff7a39>&lLIFESTEAL&8] &aYou have withdrawn %{_heartsToWithdraw}% heart(s) and received them as &cHEART(s) &ain your inventory!" to player
set {withdraw.cooldown.%player%} to true
wait 10 seconds
delete {withdraw.cooldown.%player%}
else:
send "&8[<##ff7a39>&lLIFESTEAL&8] &cYou don't have enough hearts to withdraw %{_heartsToWithdraw}% hearts!" to player
on rightclick:
if player's tool is a poppy named "&cHEART":
add 1 to max health of player
remove 1 of player's tool from the player's inventory
send "&8[<##ff7a39>&lLIFESTEAL&8] &aYou have added 1 heart back to your health!" to player