Simple Script Cooldown

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

Jul 13, 2024
1
0
1
Hello. I've been trying to make custom armor with cool "special abilities", however, I've ran into an issue with the cooldown I'm trying to implement, below is my code:

Code:
on sneak toggle:
    if player is sneaking:
        if custom model data of player's boots is 5001:
            if {cooldown.%player%} is not set or {cooldown.%player%} < now:

                push player upwards at velocity 2

                set {noFallDamage.%player%} to true
                set {hasLaunched.%player%} to true

                # Set cooldown
                set {cooldown.%player%} to now + 10 seconds
            else:
                send "&cYou must wait before using this ability again!" to player

on damage of player:
    if {noFallDamage.%victim%} is set:
        if damage cause is fall:
            cancel event
            if {hasLaunched.%victim%} is set:
                delete {hasLaunched.%victim%}

                apply swiftness 2 to victim for 10 seconds
                apply regeneration 2 to victim for 10 seconds

                loop all entities in radius 10 around victim:
                    if loop-entity is a mob:
                        strike lightning effect at loop-entity
                        set {_dx} to x-coordinate of loop-entity - x-coordinate of victim
                        set {_dz} to z-coordinate of loop-entity - z-coordinate of victim
                        set {_vector} to vector {_dx}, 0.5, {_dz}
                        set {_vector} to {_vector} * 2
                        set velocity of loop-entity to {_vector}