command with 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 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.

VojaFTW

Member
Jun 10, 2017
42
2
0
I making a reward gui but i want to command have a cooldown for example 1 hour cooldown but in my code that doesn't working and gui not appear.

code_language.skript:
command /fkit:
    trigger:
        if {fkit.%player%::cooldown} is not set:
         set {_cooldown1} to "5 hours" parsed as timespan
         set {fkit.%player%::cooldown} to difference between now and {_cooldown1}
         set {fkit.%player%::cooldown} to now
         open chest with 1 row named "&cFKit loot" to player
         wait 1 tick
         set {chance} to a random integer between 1 and 5
         if {chance} is 1:
             format slot 0 of player with feather named "&3Soon" with lore "&aComing Soon" to close then run [execute console command "/uikl %player%"]
         if {chance} is between 2 and 5:
             format slot 1 of player with 5 steak named "Steak" to close then run [execute console command "/uikl %player%"]
        else:
            message "&c[&bSkenia Items&c] You can use /fkit again after %difference between now and {fkit.%player%::cooldown}% seconds." to player

this is a test version of command becouse i'm coding to everything work and when everything work i edit rewards.

Thanks in advance
 
This should do the trick:
code_language.skript:
command /fkit:
    trigger:
        set {_cooldown1} to the difference between {fkit.%player%.lastused} and now
        if {_cooldown1} is less than 5 hours:
            message "&c[&bSkenia Items&c] You can use /fkit again after %difference between {fkit.%player%.lastused} and now% seconds."
            stop
        open chest with 1 row named "&cFKit loot" to player
        wait 1 tick
        set {chance} to a random integer between 1 and 5
        if {chance} is 1:
            format slot 0 of player with feather named "&3Soon" with lore "&aComing Soon" to close then run [execute console command "/uikl %player%"]
        if {chance} is between 2 and 5:
            format slot 1 of player with 5 steak named "Steak" to close then run [execute console command "/uikl %player%"]
        set {fkit.%player%.lastused} to now
 
This should do the trick:
code_language.skript:
command /fkit:
    trigger:
        set {_cooldown1} to the difference between {fkit.%player%.lastused} and now
        if {_cooldown1} is less than 5 hours:
            message "&c[&bSkenia Items&c] You can use /fkit again after %difference between {fkit.%player%.lastused} and now% seconds."
            stop
        open chest with 1 row named "&cFKit loot" to player
        wait 1 tick
        set {chance} to a random integer between 1 and 5
        if {chance} is 1:
            format slot 0 of player with feather named "&3Soon" with lore "&aComing Soon" to close then run [execute console command "/uikl %player%"]
        if {chance} is between 2 and 5:
            format slot 1 of player with 5 steak named "Steak" to close then run [execute console command "/uikl %player%"]
        set {fkit.%player%.lastused} to now

thanks i going to test it
[doublepost=1499857030,1499797650][/doublepost]
This should do the trick:
code_language.skript:
command /fkit:
    trigger:
        set {_cooldown1} to the difference between {fkit.%player%.lastused} and now
        if {_cooldown1} is less than 5 hours:
            message "&c[&bSkenia Items&c] You can use /fkit again after %difference between {fkit.%player%.lastused} and now% seconds."
            stop
        open chest with 1 row named "&cFKit loot" to player
        wait 1 tick
        set {chance} to a random integer between 1 and 5
        if {chance} is 1:
            format slot 0 of player with feather named "&3Soon" with lore "&aComing Soon" to close then run [execute console command "/uikl %player%"]
        if {chance} is between 2 and 5:
            format slot 1 of player with 5 steak named "Steak" to close then run [execute console command "/uikl %player%"]
        set {fkit.%player%.lastused} to now

doesn't work and saying error can't understand this expression "the difference between {fkit.%player%.lastused} and now"
 
thanks i going to test it
[doublepost=1499857030,1499797650][/doublepost]

doesn't work and saying error can't understand this expression "the difference between {fkit.%player%.lastused} and now"
Remove the "the", so it would be:
code_language.skript:
set {_cooldown1} to difference between {fkit.%player%.lastused} and now
 
  • Like
Reactions: Wynnevir
This should do the trick:
code_language.skript:
command /fkit:
    trigger:
        set {_cooldown1} to difference between {fkit.%player%.lastused} and now
        if {_cooldown1} is less than 5 hours:
            message "&c[&bSkenia Items&c] You can use /fkit again after %difference between {fkit.%player%.lastused} and now% seconds."
            stop
        open chest with 1 row named "&cFKit loot" to player
        wait 1 tick
        set {chance} to a random integer between 1 and 5
        if {chance} is 1:
            format slot 0 of player with feather named "&3Soon" with lore "&aComing Soon" to close then run [execute console command "/uikl %player%"]
        if {chance} is between 2 and 5:
            format slot 1 of player with 5 steak named "Steak" to close then run [execute console command "/uikl %player%"]
        set {fkit.%player%.lastused} to now

Remove the "the", so it would be:
code_language.skript:
set {_cooldown1} to difference between {fkit.%player%.lastused} and now

one problem i tested finally and when i do the command i set cooldown and always is higher cooldown i want to when one time is used then when player type again is saying you can use after 5 minutes again and if player try that second time saying for ex. 1 minute, ik current code is good but is not perfect, and sorry if i'm boring with requests.
 
Status
Not open for further replies.