/*

	2.9 (04-Feb-2025)
	 - Fixed the issue causing timer might incorrect counting grace time due to not resetting the old one.
	 - Fixed potential ability to restart server during map change.

	2.7 (06-Jan-2025)
	 - Added debugging code, set #define DEBUG 1

	2.6 (07-Jan-2023)
	 - Added auto-detection of Accelerator extension number (thanks to @Forgetest for coding).
	 - Command "sm_time renamed to" "sm_restarter_ctime" to prevent possible collisions.
	 - Added command "sm_restarter_accelerator" - Show auto-detected order number of Accelerator extension.
	 - Readme updated.
	 - Compatibilities with SM 1.13.

	2.5 (14-Feb-2022)
	 - Fixed: non-functional version was uploaded last time.

	2.4 (06-Feb-2022)
	 - Critical bug: fixed case, when under some circumstances* the plugin unloads himself causing server malfunction. 
	 * Plugin iterator returned null handle for current plugin. The cause of behavior is unknown and under investigation still.
	 - Fixed compilation warnings on SM 1.11.

	2.3 (23-Mar-2021)
	 - Attempt to fix hibernation ConVar for "No more room in hell".

	2.2 (07-Dec-2020)
	 - Fix for sm_restart_empty_method "3" - all plugins are been unloaded even if method "3" is used (thanks to @zombieland0302 for reporting).
	 - IsMapValid() is replaced by FindMap() to prevent undefined behaviour.

	2.1 (28-Nov-2020)
	 - Fixed mistake in a loop, causing server could restart when the last player had an index == 32.
	
	Installation:
	 - ensure you have correct server timezone and synchronized time:
	* e.g. for Linux, you can check timezone using command "timedatectl" and change timezone using command "timedatectl set-timezone TIME-ZONE"
	* or you can set UTC delta correction using ConVar "sm_restart_empty_utc_delta".

	2.0 (27-Nov-2020)
	Included requests by @Ejziponken, @PeterPan and @penalte.
	 - Added "sm_restart_empty_min_period" ConVar - Minimum period (in hours) this plugin should wait before the next restarting is allowed (0 - disable, 24 - allow once per day)
	 - Added "sm_restart_empty_limit_hour_start" ConVar - Allow rebooting to be started from this hour only (paired with "*_end" ConVar)
	 - Added "sm_restart_empty_limit_hour_end" ConVar - Allow rebooting until this hour only (paired with "*_start" ConVar)
	 - Added "sm_restart_empty_force_hour_start" ConVar - 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)
	 - Added "sm_restart_empty_force_hour_end" ConVar - 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)
	 - Added "sm_restart_empty_server_start_changemap" ConVar - When server restarted, change map to the random one from the file: data/restart_empty_maps.txt (1 - Yes / 0 - No)
	 - Prefer "sm_map" command to change the map (if available).
	 - Removed ConVar "sm_restart_empty_default_map"; use file: "data/restart_empty_maps.txt" instead.
	 - Added "sm_time" command to check server time (taking into account utc delta ConVar).
	 
	See updated 1st post and [B]Suggestions on Setup[/b] Section.

	1.9
	 - Fixed warnings

	1.8
	 - Default grace time ConVar is decreased down to 1 sec. to prevent misunderstanding of this feature by server administrators.
	 - Corrected identification of crash log from MyArena.ru server to clear it after server restart.

	1.7
	 - Added ConVar: "sm_restart_empty_unload_ext_num". If you have Accelerator extension,
	 you need specify here order number of this extension in the list by executing "sm exts list" command, to prevent creating false crash log.
	 Plugin will automatically unload this extension before restarting the server.
	 - Log path location is changed to logs/restart.log
	 - no more auto-create "CRASH" folder (since it was a speficic of myarena.ru hosting only)
	 - All ConVars are cached.
	 - Some simplifications.

	1.6
	 - Added all plugins unload before restarting the server (for safe).

	1.5
	 - Added change map method. New ConVar "sm_restart_empty_default_map" - Map name to change to when server become empty

	1.4
	 - Fixed "Client index 0 is invalid" in IsFakeClient() check.
	 
	1.3
	 - Added sv_hibernate_when_empty to force server not hibernate allowing this plugin to make its work
	 - Added alternative method for restarting ("crash" command) (thanks to Luckylock)
	 - Added ConVars
	 - Crash logs remover: parser method is replaced by time based method.
	 - Create "CRASH" folder

	1.2
	 - Removing crash logs caused by server restart for some reason

	1.1
	 - Added log file

	ChangeLog
	1.0
	 - Initial release

*/
