Skript cooldown cancel if player leaves inventory

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

Status
Not open for further replies.

GamingCarmelo

New Member
Mar 1, 2021
2
0
1
24
I currently have a /warps skript with several warps with a cooldown of 30 minutes everytime someone uses this command. But my issue is if someone was to leave this inventory, the cooldown would still start. Anyone know how to fix this? also I tried adding cooldown cancel after send "&cCould not teleport you to Europe" to player but it didn't work. Anyone know how I can add a cooldown cancel if the else statement happens?

My questions:
1) How to add a cooldown cancel when a player exits the inventory gui
2) How to add a cooldown cancel when the else statement happens
Code:
command /warps:
    cooldown: 30 minutes
    cooldown message: &ePlease wait %remaining time% to use /warps again
    trigger:
        open virtual chest with 1 rows named "&a&lWarps" to player
        format gui slot 1 of player with Grass block named "&aEurope" to run:
            send "&aStand still for 3 seconds to be teleported to Europe"
            close player's inventory
            set {_x} to x-coords of player
            set {_z} to z-coords of player
            wait 3 seconds
            set {_x-now} to x-coords of player
            set {_z-now} to z-coords of player
            if {_x-now} = {_x}:
                if {_z-now} = {_z}:
                    send "&aYou have successfully been teleported to Europe"
                    teleport player to location 3752, 123, -10560 in world "GCEarth"
                else:
                    send "&cCould not teleport you to Europe" to player
                    stop
 
I currently have a /warps skript with several warps with a cooldown of 30 minutes everytime someone uses this command. But my issue is if someone was to leave this inventory, the cooldown would still start. Anyone know how to fix this? also I tried adding cooldown cancel after send "&cCould not teleport you to Europe" to player but it didn't work. Anyone know how I can add a cooldown cancel if the else statement happens?

My questions:
1) How to add a cooldown cancel when a player exits the inventory gui
2) How to add a cooldown cancel when the else statement happens
Code:
command /warps:
    cooldown: 30 minutes
    cooldown message: &ePlease wait %remaining time% to use /warps again
    trigger:
        open virtual chest with 1 rows named "&a&lWarps" to player
        format gui slot 1 of player with Grass block named "&aEurope" to run:
            send "&aStand still for 3 seconds to be teleported to Europe"
            close player's inventory
            set {_x} to x-coords of player
            set {_z} to z-coords of player
            wait 3 seconds
            set {_x-now} to x-coords of player
            set {_z-now} to z-coords of player
            if {_x-now} = {_x}:
                if {_z-now} = {_z}:
                    send "&aYou have successfully been teleported to Europe"
                    teleport player to location 3752, 123, -10560 in world "GCEarth"
                else:
                    send "&cCould not teleport you to Europe" to player
                    stop
Code:
command /warps:
    trigger:
        open virtual chest with 1 rows named "&a&lWarps" to player
        format gui slot 1 of player with Grass block named "&aEurope" to run:
            set {_waited} to difference between {cake.%player%.lastused} and now
            if {_waited} is less than 30 minutes:
                send "&ePlease wait %difference between a minute and {_waited}% to use /warps again"
            else:
                send "&aStand still for 3 seconds to be teleported to Europe"
                close player's inventory
                set {_x} to x-coords of player
                set {_z} to z-coords of player
                wait 3 seconds
                set {_x-now} to x-coords of player
                set {_z-now} to z-coords of player
                if {_x-now} = {_x}:
                    if {_z-now} = {_z}:
                        send "&aYou have successfully been teleported to Europe"
                        teleport player to location 3752, 123, -10560 in world "GCEarth"
                        set {cake.%player%.lastused} to now
                    else:
                        send "&cCould not teleport you to Europe" to player
                        stop
 
Status
Not open for further replies.