Auto restart

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

sandor_1234

Active Member
Jan 26, 2017
165
5
0
21
If i would use:
code_language.skript:
on load:
    wait 6 hours
    make console execute command "stop"
Would this just work and not get stuck because its such a big time.
And it will check all this time if the 6 hours already are reached so...
 
What i recommend is this code:

code_language.skript:
every 6 hours:
    make console execute command "stop"
    stop

This will work without problems :emoji_slight_smile:, hope it helps. You don't need an Addon for this.
 
It would work, but it would happen EVERY time the server started (even if it was due to a crash) instead of at specific times (which is ideal so players can expect the restarts), and you would have no way to cancel it because it's all encapsulated inside that event with no way for you to intercept it once the countdown begins.

I use something like this:

code_language.skript:
command /cancelrestart:
    permission: skript.admin
    trigger:
        set {cancelNextRestart} to true
        send "The next automated restart will be canceled" to the player

every minute:
    if "%now%" contains "11:55":
        {cancelNextRestart} isn't true
        broadcast "The server will restart in 5 minutes."
        set {timeUntilRestart} to 5 minutes
    else if "%now%" contains "11:59":
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        broadcast "The server will restart in 1 minute."
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        wait 50 seconds
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        broadcast "10 seconds until restart, stop all crafting and similar actions!"10 ticks fade out
        wait 7 seconds
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        loop 3 times:
            broadcast "Restart in %4 - loop-number%..."
            wait 1 second
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        execute console command "/restart"
 
  • Like
Reactions: Spirit1998HD
It would work, but it would happen EVERY time the server started (even if it was due to a crash) instead of at specific times (which is ideal so players can expect the restarts), and you would have no way to cancel it because it's all encapsulated inside that event with no way for you to intercept it once the countdown begins.

I use something like this:

code_language.skript:
command /cancelrestart:
    permission: skript.admin
    trigger:
        set {cancelNextRestart} to true
        send "The next automated restart will be canceled" to the player

every minute:
    if "%now%" contains "11:55":
        {cancelNextRestart} isn't true
        broadcast "The server will restart in 5 minutes."
        set {timeUntilRestart} to 5 minutes
    else if "%now%" contains "11:59":
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        broadcast "The server will restart in 1 minute."
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        wait 50 seconds
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        broadcast "10 seconds until restart, stop all crafting and similar actions!"10 ticks fade out
        wait 7 seconds
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        loop 3 times:
            broadcast "Restart in %4 - loop-number%..."
            wait 1 second
        if {cancelNextRestart} is true:
            delete {cancelNextRestart}
            stop
        execute console command "/restart"

Yeah, thats a nice idea. Thumbs up for this! :emoji_slight_smile:
[doublepost=1485717773,1485546965][/doublepost]#Solved
 
Status
Not open for further replies.