Cooldown Problems

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

BestGamerNL

Member
Apr 25, 2017
38
1
0
25
Heey guys im working on a network with my friend it called stereonetwork.
And soon we will release factions and we have some custom made skripts like. Speed, Fly, Etc

But now i have one problem and that is how can i add cooldown for strength if they used it for 30 seconds
This is my skript what i now have

code_language.skript:
command /strength:
    usage: /strength
    permission: strength.use
    permission message: {@PermissionDenymessage}
    executable by: players
    trigger:
        If {strength.%player%} is not set:
            Send "{@StrengthEnabled}" to player
            apply potion of strength 2 to the player for 30 seconds
            Set {strength.%player%} to true
            Stop
        Send "{@StrengthDisabled}" to player
        remove strength from player
        Delete {strength.%player%}
        Stop

Does some one know how to fix it with an cooldown when the 30 seconds are over the maxium cooldown what i want is one hour please somebody can help me
 
A really good example of this actually comes with skrip when you download it, in your sk files. but i'll put it here too
code_language.skript:
# This script is a template for commands which have a cooldown.
# I will add a more intuitive way of handling cooldowns/countdowns in the future,
# But for now please use something like this.
# Make sure that you do not use delays for cooldowns as they stop when the server stops.
#

# This command allows each player to get infinite cakes
# but the command has a cooldown of one minute (per player)
command /cake:
    description: Recieve a cake, but you can only do this once per minute!
    permission: cake.is_a_lie
    executable by: players
    trigger:
        # stores how long it's been since the player last used this command
        set {_waited} to difference between {cake.%player%.lastused} and now
        # checks whether the player has used the command within the last minute
        if {_waited} is less than a minute:
            message "You have to wait %difference between a minute and {_waited}% before you can use this command again!"
            stop
        
        # some condition which sould not start the cooldown
        # (if the player doesn't get the cake he should be able to use the command again immediately)
        player doesn't have space for a cake:
            message "You do not have enough space in your inventory to hold the cake!"
            stop
            
        # do the action of the command
        give a cake to the player
        
        # and finally start the cooldown
        set {cake.%player%.lastused} to now
 
It looks prety nice but i dont really understand what your trying to type i have now this and i want a cooldown but it is not woking for me

code_language.skript:
command /strength:
    usage: /strength
    permission: strength.use
    permission message: {@PermissionDenymessage}
    executable by: players
    trigger:
        If {strength.%player%} is not set:
            Send "{@StrengthEnabled}" to player
            apply potion of strength 2 to the player for 30 seconds
            Set {strength.%player%} to true
            Stop
        Send "{@StrengthDisabled}" to player
        if {_waited} is less than a hour:
        send "&cYou need to wait 1 hour before using again!"
        remove strength from player
        Delete {strength.%player%}
        Stop
 
Use list variables.
code_language.skript:
command /strength:
    permission: strength.use
    permission message: {@PermissionDenymessage}
    executable by: players
    trigger:
        {strength::%player%} isn't set:
            send "Applied strength for 30 seconds."
            apply potion of strength 2 to player for 30 seconds
            set {strength::%player%} to true
            wait 60 seconds
            {strength::%player%} is set:
                delete {strength::%player%}
            stop
        send "You need to wait a minute to use the command again."
 
Use list variables.
code_language.skript:
command /strength:
    permission: strength.use
    permission message: {@PermissionDenymessage}
    executable by: players
    trigger:
        {strength::%player%} isn't set:
            send "Applied strength for 30 seconds."
            apply potion of strength 2 to player for 30 seconds
            set {strength::%player%} to true
            wait 60 seconds
            {strength::%player%} is set:
                delete {strength::%player%}
            stop
        send "You need to wait a minute to use the command again."

Looks cool but where is my Enable and Disable messages xD
 
Status
Not open for further replies.