Variable not changing but hearts are

  • 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 community!

    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!

Status
Not open for further replies.

ArchLinux42

Member
May 23, 2022
1
0
1
I'm new to skripting and I am having a little trouble. The variable doesn't seem to change but it gives hearts over the maximum.


Code:
on join:
    if {joins::*} does not contain player's uuid:
        add player's uuid to {joins::*}
        set {health::%uuid of player%} to 10
on death of player:
    if attacker is a player:
        if maximum health of attacker <= 200:
            if maximum health of victim >= 1:
                add 1 to {health::%uuid of attacker%}
                set the maximum health of attacker to {health::%uuid of attacker%}
                execute console command "/heal %attacker%"
                subtract 1 from {health::%uuid of victim%}
                set the maximum health of victim to {health::%uuid of victim%}
            else:
                send "You cant gain hearts from this player"
                stop
command /sethearts [<offline player>] [<number>]:
    permission: skript.sethearts
    trigger:
        set {health::%uuid of arg-1%} to arg-2
        set the maximum health of arg-1 to {health::%uuid of arg-1%}
        message "&6Set %arg-1%'s hearts to %arg-2%"
command /resethearts [<offline player>]:
    permission: skript.resethearts
    trigger:
        set {health::%uuid of arg-1%} to 10
        set the maximum health of arg-1 to 10
        message "&6Reset %arg-1%'s hearts"
command /hearts [<offline player>]:
    permission: skript.hearts
    trigger:
        message "&6%arg-1% has %{health::%uuid of arg-1%}% hearts"
 
Status
Not open for further replies.