Cooldown persisting through restarts

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

Dimrok

Member
Dec 17, 2018
2
0
0
47
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_language.skript:
on mine:
    if event-block is stone:
        cancel event
        set the block to CRACKED STONE BRICKS
        set {cooldown::%event-location%} to now
        if difference between {cooldown::%event-location%} and now is greater than 3 seconds:
            set the block to STONE
    cancel event
    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.
[doublepost=1545098831,1545020224][/doublepost]anyone?
 
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_language.skript:
on mine:
    if event-block is stone:
        cancel event
        set the block to CRACKED STONE BRICKS
        set {cooldown::%event-location%} to now
        if difference between {cooldown::%event-location%} and now is greater than 3 seconds:
            set the block to STONE
    cancel event
    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.
[doublepost=1545098831,1545020224][/doublepost]anyone?

code_language.skript:
on mine:
    if event-block is stone:
        cancel event
        set the block to CRACKED STONE BRICKS
        wait 3 seconds
        set the block to STONE
    cancel event
    send "You cannot break this block"
should do fine
 
code_language.skript:
on mine:
    if event-block is stone:
        cancel event
        set the block to CRACKED STONE BRICKS
        wait 3 seconds
        set the block to STONE
    cancel event
    send "You cannot break this block"
should do fine

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.
 
I already made a code similar to what you want ... analyze it and see if it can help you!

code_language.skript:
on break:
        
    if block is andesite:
        cancel event
        add event-location to {andesite.reload::*}
        set block to air

command /resetore:
    trigger:
        if name of player is {@staff}:
            send "   &eresetando todas minas..."
            loop {andesite.reload::*}:
                if block at loop-value is air:
                    
                    set block at loop-value to andesite
                    remove loop-value from {andesite.reload::*}

every 1 hours:
    loop {andesite.reload::*}:
        if block at loop-value is air:

            set block at loop-value to andesite
             remove loop-value from {andesite.reload::*}
 
Status
Not open for further replies.