View Single Post
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-04-2019 , 12:40   [ANY] Restart Empty Server (or Map)
Reply With Quote #1

Description:
Restarts the server (or changes the map) when all players leave the game / or optionally, by the scheduled hours.
Features:
- 3 methods of server restart: using "crash", using "_restart", or just change the map.
- Grace period - plugin waits some time for a new player to connect before actually decide to restart.
- unloads the "Accelerator" extension to prevent false crash reports.
- correctly free resources by unloading all plugins before actual restarting
- Able to remove the false crash log in the "CRASH" folder - some servers create it
- Control sv_hibernate_when_empty ConVar. Some admins (hosters) setup it, so many similar plugins cannot perform a restart due to plugin freeze.
- (optionally) start-end hours where restart allowed
- (optionally) start-end hours to force restart (with kicking the players)
- (optionally) restrict the frequency of restarting
- the restart time is logged to file: addons/sourcemod/logs/restart.log
Recommended for:
- prophylaxis
- fixing the bug related to resetting all ConVars to defaults (seen on some servers). The source of the problem is unknown.
Requirements:
- Regexp extension (included in SourceMod).
Settings (ConVars):
see: cfg/sourcemod/sm_restart_empty.cfg:

- sm_restart_empty_enable - def.: 1 - Enable plugin (1 - On / 0 - Off)
- sm_restart_empty_method - def.: 2 - When server is empty, what to do? 1 - _restart, 2 - crash (use if method # 1 is not work), 3 - just change map
- sm_restart_empty_delay - def.: 1.0 - Grace period (in sec.) waiting for new player to join until actually decide to restart the server
- sm_restart_empty_unload_ext_num - def.: 0 - If you have Accelerator extension, you need specify here order number of this extension in the list: sm exts list
- sm_restart_empty_min_period - def.: 0 - Minimum period (in hours) this plugin should wait before the next restarting is allowed (0 - disable, 24 - allow once per day)
- sm_restart_empty_limit_hour_start - def.: 0 - Allow rebooting to be started from this hour only (paired with "*_end" ConVar)
- sm_restart_empty_limit_hour_end - def.: 24 - Allow rebooting until this hour only (paired with "*_start" ConVar)
- sm_restart_empty_force_hour_start - def.: -1 - Start hour for force rebooting (if last reboot happened > 24 hours ago) and somebody leaves during this hour (paired with "*_end" ConVar) (-1 to disable)
- sm_restart_empty_force_hour_end - def.: -1 - End hour for force rebooting (if last reboot happened > 24 hours ago) and somebody leaves during this hour (paired with "*_start" ConVar) (-1 to disable)
- sm_restart_empty_utc_delta - def.: 0.0 - If your server has incorrect time, you can set UTC correction hours here (they will be appended to a server time)
- sm_restart_empty_server_start_changemap - def.: 0 - When server restarted, change map to the random one from the file: data/restart_empty_maps.txt (1 - Yes / 0 - No)
Commands: (both intended for plugin setup stage)
sm_restarter_ctime - Check the server time taking into account UTC delta ConVar
sm_restarter_accelerator - Show auto-detected order number of Accelerator extension
Installation
1. Unpack the archive and place its contents to addons/sourcemod
2. If you plan to use map change features, edit file "addons/sourcemod/data/restart_empty_maps.txt" inserting your own map list (one per line) you want to randomly change map to.
3. Change the map.
4. See Suggestions on Setup section
5.
If you have "Accelerator" extension, do this:

Suggestions on Setup
Spoiler


Credits:
- @Luckylock - for alternative way of reboot, "crash" command.
- @Forgetest - for coding auto-detection of Accelerator extension order number.
Related plugins:
[ANY] Vote server restart
ChangeLog
Spoiler


Donate
Donates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
- Patreon (Paypal)
- BitCoin
- Ю.Money
Attached Files
File Type: zip RestartEmpty_v2.6.zip (17.9 KB, 708 views)
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 01-07-2023 at 10:28.
Dragokas is offline