I NEED COOLDOWN ON THIS

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

sharpintel123

Member
May 4, 2024
25
0
1
on right click:
player is holding 1 of glowing carrot on a stick named "&4&lBuff" with lore "&7Right click to gain postive affects":
apply potion of speed of tier 2 to player for 16 second
apply potion of strength of tier 2 to player for 16 second
apply potion of regeneration of tier 1 to player for 16 second
apply potion of fire resistance of tier 1 to player for 16 second
 
can some one add remaining time to this pls
on right click:
player is holding 1 of glowing carrot on a stick named "&4&lBuff" with lore "&7Right click to gain postive affects":
if {cooldown.%player%} is true:
message "&6You are on cooldown pls wait you have &lRemaning time here" to player
stop
else:
set {cooldown.%player%} to true
apply speed 2 to player for 16 seconds
apply strength 2 to player for 16 seconds
apply regeneration 1 to player for 16 seconds
apply fire resistance 1 to player for 16 seconds
apply glowing to player for 20 seconds
message "&bYou have been given the Buff effects" to player
wait 60 seconds
set {cooldown.%player%} to false
 
Code:
on right click:
    player is holding 1 of glowing carrot on a stick named "&4&lBuff" with lore "&7Right click to gain postive affects":
        if {cooldown.%player%} is true:
            message "&6You are on cooldown pls wait you have &l%{timer::%player%}%" to player
            stop
        else:
        set {cooldown.%player%} to true
        set {timer::%player%} to 60
        apply speed 2 to player for 16 seconds
        apply strength 2 to player for 16 seconds
        apply regeneration 1 to player for 16 seconds
        apply fire resistance 1 to player for 16 seconds
        apply glowing to player for 20 seconds
        message "&bYou have been given the Buff effects" to player
        wait 60 seconds
        set {cooldown.%player%} to false

every 1 second
    remove 1 from {timer::*}
I didn't test it but i think this should work
 
doesnt work heres my error code
skript reload buff.sk
[23:10:10 INFO]: [Skript] Reloading buff.sk...
[23:10:10 INFO]: Line 20: (buff.sk)
[23:10:10 INFO]: Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section.
[23:10:10 INFO]: Line: else:
[23:10:10 INFO]:
[23:10:10 INFO]: Line 33: (buff.sk)
[23:10:10 INFO]: indentation error: expected 0 spaces, but found 4 spaces
[23:10:10 INFO]: Line: remove 1 from {timer::*}
[23:10:10 INFO]:
[23:10:10 INFO]: Line 32: (buff.sk)
[23:10:10 INFO]: invalid line - all code has to be put into triggers
[23:10:10 INFO]: Line: every 1 second
[23:10:10 INFO]:
[23:10:10 INFO]: Line 8: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown} to difference between {cooldown.%player%} and now
[23:10:10 INFO]:
[23:10:10 INFO]: Line 12: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to now
[23:10:10 INFO]:
[23:10:10 INFO]: Line 17: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: if {cooldown.%player%} is true:
[23:10:10 INFO]:
[23:10:10 INFO]: Line 18: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: message "&6You are on cooldown pls wait you have &l%{timer::%player%}%" to player
[23:10:10 INFO]:
[23:10:10 INFO]: Line 21: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to true
[23:10:10 INFO]:
[23:10:10 INFO]: Line 22: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {timer::%player%} to 60
[23:10:10 INFO]:
[23:10:10 INFO]: Line 30: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to false
[23:10:10 INFO]:
[23:10:10 INFO]: [Skript] Encountered 2 errors while reloading buff.sk! (64ms)
 
doesnt work heres my error code
skript reload buff.sk
[23:10:10 INFO]: [Skript] Reloading buff.sk...
[23:10:10 INFO]: Line 20: (buff.sk)
[23:10:10 INFO]: Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section.
[23:10:10 INFO]: Line: else:
[23:10:10 INFO]:
[23:10:10 INFO]: Line 33: (buff.sk)
[23:10:10 INFO]: indentation error: expected 0 spaces, but found 4 spaces
[23:10:10 INFO]: Line: remove 1 from {timer::*}
[23:10:10 INFO]:
[23:10:10 INFO]: Line 32: (buff.sk)
[23:10:10 INFO]: invalid line - all code has to be put into triggers
[23:10:10 INFO]: Line: every 1 second
[23:10:10 INFO]:
[23:10:10 INFO]: Line 8: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown} to difference between {cooldown.%player%} and now
[23:10:10 INFO]:
[23:10:10 INFO]: Line 12: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to now
[23:10:10 INFO]:
[23:10:10 INFO]: Line 17: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: if {cooldown.%player%} is true:
[23:10:10 INFO]:
[23:10:10 INFO]: Line 18: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: message "&6You are on cooldown pls wait you have &l%{timer::%player%}%" to player
[23:10:10 INFO]:
[23:10:10 INFO]: Line 21: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to true
[23:10:10 INFO]:
[23:10:10 INFO]: Line 22: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {timer::%player%} to 60
[23:10:10 INFO]:
[23:10:10 INFO]: Line 30: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to false
[23:10:10 INFO]:
[23:10:10 INFO]: [Skript] Encountered 2 errors while reloading buff.sk! (64ms)
Code:
on right click with carrot on a stick:
    if name of player's held item is "&4&lBuff":
        if lore of player's held item is "&7Right click to gain postive affects":
            if {cooldown::%player's uuid%} is true:
                message "&6You are on cooldown pls wait you have &l%{timer::%player%}%" to player
                stop
            else:
                set {cooldown::%player's uuid%} to true
                set {timer::%player's uuid%} to 60
                apply speed 2 to player for 16 seconds
                apply strength 2 to player for 16 seconds
                apply regeneration 1 to player for 16 seconds
                apply fire resistance 1 to player for 16 seconds
                apply glowing to player for 20 seconds
                message "&bYou have been given the Buff effects" to player
                wait 60 seconds
                set {cooldown::%player's uuid%} to false

every 1 second:
    remove 1 from {timer::*}
 
doesnt work heres my error code
skript reload buff.sk
[23:10:10 INFO]: [Skript] Reloading buff.sk...
[23:10:10 INFO]: Line 20: (buff.sk)
[23:10:10 INFO]: Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section.
[23:10:10 INFO]: Line: else:
[23:10:10 INFO]:
[23:10:10 INFO]: Line 33: (buff.sk)
[23:10:10 INFO]: indentation error: expected 0 spaces, but found 4 spaces
[23:10:10 INFO]: Line: remove 1 from {timer::*}
[23:10:10 INFO]:
[23:10:10 INFO]: Line 32: (buff.sk)
[23:10:10 INFO]: invalid line - all code has to be put into triggers
[23:10:10 INFO]: Line: every 1 second
[23:10:10 INFO]:
[23:10:10 INFO]: Line 8: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown} to difference between {cooldown.%player%} and now
[23:10:10 INFO]:
[23:10:10 INFO]: Line 12: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to now
[23:10:10 INFO]:
[23:10:10 INFO]: Line 17: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: if {cooldown.%player%} is true:
[23:10:10 INFO]:
[23:10:10 INFO]: Line 18: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: message "&6You are on cooldown pls wait you have &l%{timer::%player%}%" to player
[23:10:10 INFO]:
[23:10:10 INFO]: Line 21: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to true
[23:10:10 INFO]:
[23:10:10 INFO]: Line 22: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {timer::%player%} to 60
[23:10:10 INFO]:
[23:10:10 INFO]: Line 30: (buff.sk)
[23:10:10 INFO]: In the future, players in variable names will use the player's UUID instead of their name. For information on how to make sure your scripts won't be impacted by this change, see https://github.com/SkriptLang/Skript/discussions/6270.
[23:10:10 INFO]: Line: set {cooldown.%player%} to false
[23:10:10 INFO]:
[23:10:10 INFO]: [Skript] Encountered 2 errors while reloading buff.sk! (64ms)
oh i forgot to put : in every 1 second line
 
Code:
on right click with carrot on a stick:
    if name of player's held item is "&4&lBuff":
        if lore of player's held item is "&7Right click to gain postive affects":
            if {cooldown::%player's uuid%} is true:
                message "&6You are on cooldown pls wait you have &l%{timer::%player%}%" to player
                stop
            else:
                set {cooldown::%player's uuid%} to true
                set {timer::%player's uuid%} to 60
                apply speed 2 to player for 16 seconds
                apply strength 2 to player for 16 seconds
                apply regeneration 1 to player for 16 seconds
                apply fire resistance 1 to player for 16 seconds
                apply glowing to player for 20 seconds
                message "&bYou have been given the Buff effects" to player
                wait 60 seconds
                set {cooldown::%player's uuid%} to false

every 1 second:
    remove 1 from {timer::*}
it doesnt show time it just says <none>
 
it doesnt show time it just says <none>
Code:
on right click with carrot on a stick:
    if name of player's held item is "&4&lBuff":
        if lore of player's held item is "&7Right click to gain postive affects":
            if {cooldown::%player's uuid%} is not set:
                set {cooldown::%player's uuid%} to 60
                apply speed 2 to player for 16 seconds
                apply strength 2 to player for 16 seconds
                apply regeneration 1 to player for 16 seconds
                apply fire resistance 1 to player for 16 seconds
                apply glowing to player for 20 seconds
                message "&bYou have been given the Buff effects" to player
            else:
                send "&6You are on cooldown pls wait you have &l%{cooldown::%player's uuid%}% seconds" to player

every 20 ticks:
    loop all players:
        if {cooldown::%loop-player's uuid%} is set:
            if {cooldown::%loop-player's uuid%} >= 1:
                remove 1 from {cooldown::%loop-player's uuid%}
            if {cooldown::%loop-player's uuid%} is less or equal to 0:
                delete {cooldown::%loop-player's uuid%}

That should work. However, the cooldown does not continue if the player is offline. I don't know if the whole thing is that performant, but it should work.
 
do something like
Code:
command /testcommand:
    trigger:
        if the difference between {testcommandcooldown.%player's uuid%} and now is 5: #whatever you want the timer to be
            #run stuff
            set {testcommandcooldown.%player's uuid%} to now
# if you wanna get extra fancy add
        else:
            send "Time Left: %difference between {testcommandcooldown.%player's uuid%} and now%" to player