Author Topic: Restart Timer Command  (Read 7608 times)

0 Members and 1 Guest are viewing this topic.

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 470
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Restart Timer Command
« on: January 18, 2015, 11:44:00 PM »
This was mostly just done for my server in the event that we needed a restart for some reason but I'm making it public cause I'm awesome.

Once you set the timer, it counts down from your set amount to 0 in minutes. It rounds to the nearest whole number, so no 2.5 minutes, etc.. It will also display each minute how many minutes you have remaining all the way to 0, where it gives you a final 3 seconds before it restarts the server. At any time during the countdown, you can abort it by typing !restartabort in chat. If you abort, it will show you how many minutes you had remaining before the shutdown.

Contains the following:

!restart - Sets the time for a server restart in minutes. (!restart <time>)

!restartabort - Aborts the current restart and displays the time remaining.

!restartpause - Pauses a Server Restart Timer.

!restartresume - Resumes a Server Restart Timer.

Let me know if there are any issues.

UPDATE:

Fixed the !restart 0 issue where the server would not run the restart.



Possible Updates:
More exact time remaining.
Partial Minutes - 30 seconds, 45 seconds, etc..
Graphical Interface displaying time left.

Suggestions/Requests?
« Last Edit: March 25, 2015, 05:36:18 PM by syst3M4TiK »
Once you get to know me, you'll find you'll have never met me at all.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2644
  • Karma: 414
    • |G4P| Gman4President
Re: Restart Timer Command
« Reply #1 on: January 19, 2015, 08:15:48 AM »
You can pause and unpause a timer to make your resume function:
http://wiki.garrysmod.com/page/timer/Pause
http://wiki.garrysmod.com/page/timer/UnPause

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 470
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Restart Timer Command
« Reply #2 on: January 19, 2015, 08:36:49 AM »
Completely overlooked the pause function, thanks Mr.P
Once you get to know me, you'll find you'll have never met me at all.

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 470
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Restart Timer Command
« Reply #3 on: January 19, 2015, 04:58:59 PM »
Update: Added Pause/Resume and some configuration options.
Once you get to know me, you'll find you'll have never met me at all.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 7924
  • Karma: 372
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Restart Timer Command
« Reply #4 on: January 19, 2015, 08:27:23 PM »
Nice work. Simple yet effective, and could actually be used as template for other ideas/learning.
Glad you found some of my ramblings useful.
The price one pays for pursuing any profession or calling is an intimate knowledge of its ugly side. - James Baldwin

Offline PatrickNL

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: Restart Timer Command
« Reply #5 on: February 25, 2015, 10:36:36 AM »
If you set a time and it did restart, do i have to set up the time again?

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 470
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Restart Timer Command
« Reply #6 on: February 25, 2015, 12:21:22 PM »
at this time, yes. I will write an auto restart command that you can set to restart after (x) minutes after the server is launched
Once you get to know me, you'll find you'll have never met me at all.

Offline PatrickNL

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: Restart Timer Command
« Reply #7 on: February 25, 2015, 01:20:47 PM »
Yeah, i want it to make a restart 1x per day, but it's not working after map change :p

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 470
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Restart Timer Command
« Reply #8 on: February 25, 2015, 10:54:44 PM »
If you have a server that changes maps, then it won't be able to run every 86400 seconds (1 day) because it runs with the server. If the server changes maps, it kills the restart timer.
Once you get to know me, you'll find you'll have never met me at all.

Offline Neku

  • Hero Member
  • *****
  • Posts: 550
  • Karma: 27
  • Foxxy Lua
    • Dubstep Mayhem
Re: Restart Timer Command
« Reply #9 on: February 25, 2015, 11:23:39 PM »
If you have a server that changes maps, then it won't be able to run every 86400 seconds (1 day) because it runs with the server. If the server changes maps, it kills the restart timer.

Store the time in a data file. Or even a database.
Out of the Garry's Mod business.

Many thanks to JamminR for changing my name.

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 470
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Restart Timer Command
« Reply #10 on: February 25, 2015, 11:27:13 PM »
I didnt think of that, that could work.
Once you get to know me, you'll find you'll have never met me at all.

Offline silentkiller101

  • Newbie
  • *
  • Posts: 14
  • Karma: -1
Re: Restart Timer Command
« Reply #11 on: March 15, 2015, 07:10:11 PM »
Does this still work or did the update break it?

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Restart Timer Command
« Reply #12 on: March 16, 2015, 05:16:11 PM »
Does this still work or did the update break it?

Everything works fine for me!

Offline silentkiller101

  • Newbie
  • *
  • Posts: 14
  • Karma: -1
Re: Restart Timer Command
« Reply #13 on: March 17, 2015, 12:01:26 PM »
Everything works fine for me!

Doesn't work for me, when i click restart it says the server has been set to restart but then it doesn't do anything


Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Restart Timer Command
« Reply #14 on: March 17, 2015, 02:01:15 PM »
Ohh yes this error! (not a console error) Just do !restart 1 its alot easier!