Need help with Lifesteal Skript

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

speoxe

Member
Aug 15, 2024
1
0
1
18
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
 
I dont undestand your code at all, i can help you, if you explain what EXACTLY should the command do.. Your code is really messy and i cant tell what are you trying to do.
Also PLEASE use the code format, because this is horrible..
 
Hello!

Since you are calling for the exact tool, it has to be one.

One way to fix this is to change:

code_language.skript:
if player's tool is a poppy named "&cHEART":

To:

code_language.skript:
name of tool of player contains "&cHEART":