1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cooldown persisting through restarts

Discussion in 'Skript' started by Dimrok, Dec 17, 2018.

Thread Status:
Not open for further replies.
  1. Dimrok

    Dimrok Member

    Joined:
    Dec 17, 2018
    Messages:
    2
    Likes Received:
    0
    I'm trying to have a cooldown set through server restarts.

    It should replace the block with the cracked stone bricks, then after the cooldown set it back to a stone block.

    I set it to 3 seconds for testing, I want this to be about a 3 hour cooldown when it's working.

    This is my code

    Code (Skript):
    1. on mine:
    2.     if event-block is stone:
    3.         cancel event
    4.         set the block to CRACKED STONE BRICKS
    5.         set {cooldown::%event-location%} to now
    6.         if difference between {cooldown::%event-location%} and now is greater than 3 seconds:
    7.             set the block to STONE
    8.     cancel event
    9.     send "You cannot break this block"
    Today is literally my first day to ever try skript and I have no coding knowledge prior to this.

    I don't know why this doesn't work.

    It sets it to cracked stone bricks, but doesn't change the block back to stone.
    --- Double Post Merged, Dec 18, 2018, Original Post Date: Dec 17, 2018 ---
    anyone?
     
  2. Runakai

    Moderator Supporter

    Joined:
    Apr 27, 2018
    Messages:
    497
    Likes Received:
    31
    Code (Skript):
    1.  
    2. on mine:
    3.     if event-block is stone:
    4.         cancel event
    5.         set the block to CRACKED STONE BRICKS
    6.         wait 3 seconds
    7.         set the block to STONE
    8.     cancel event
    9.     send "You cannot break this block"
    should do fine
     
  3. Dimrok

    Dimrok Member

    Joined:
    Dec 17, 2018
    Messages:
    2
    Likes Received:
    0
    I know that works. That was my first test. However, I need the cooldown to be 3 hours and if the server restarts then they'll all be stuck as cracked stone bricks with your method.

    I was using 3 seconds for testing purposes.
     
  4. Yodaylay22

    Yodaylay22 Member

    Joined:
    Jul 24, 2018
    Messages:
    15
    Likes Received:
    1
    I already made a code similar to what you want ... analyze it and see if it can help you!

    Code (Skript):
    1. on break:
    2.        
    3.     if block is andesite:
    4.         cancel event
    5.         add event-location to {andesite.reload::*}
    6.         set block to air
    7.  
    8. command /resetore:
    9.     trigger:
    10.         if name of player is {@staff}:
    11.             send "   &eresetando todas minas..."
    12.             loop {andesite.reload::*}:
    13.                 if block at loop-value is air:
    14.                    
    15.                     set block at loop-value to andesite
    16.                     remove loop-value from {andesite.reload::*}
    17.  
    18. every 1 hours:
    19.     loop {andesite.reload::*}:
    20.         if block at loop-value is air:
    21.  
    22.             set block at loop-value to andesite
    23.              remove loop-value from {andesite.reload::*}
     
Thread Status:
Not open for further replies.

Share This Page

Loading...