AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   Crashed Map Recovery v1.5 (https://forums.alliedmods.net/showthread.php?t=99276)

crazydog 08-03-2009 11:14

Crashed Map Recovery v1.5
 
12 Attachment(s)
Description:
This plugin will save the map your server is on to a data file, and reload that map when the server restarts for any reason (for example, after a crash).

Installation:
1) Upload crashmap.smx to addons/sourcemod/plugins/
2) Restart your server (Important!)
3) Edit cfg/sourcemod/plugin.crashmap.cfg to your needs

Cvars:
sm_crashmap_enabled - Enables (1-Default) or Disables (0) the plugin. Note that if disabled, map names will not be stored
sm_crashmap_recovertime - Enables (1) or Disables (0-Default) the ability to recover the timelimit of the server.
sm_crashmap_interval - Time interval (in seconds) between updates of timeleft. (Default 20, min 1)
sm_crashmap_maxrestarts - Number of restarts that can happen before the default map is loaded. (Default 5, min 3)
sm_crashmap_version - Shows the version

Notes:
A little about how sm_crashmap_maxrestarts works:
Every time the map is recovered after a crash, the # of restarts goes up. Once it's higher than sm_crashmap_maxrestarts, the server will stay on the default map (set in the command line). If your default map crashes, that's something YOU should fix.

There are 2 ways for the # of restarts to be reset:
1) A player successfully connects to the server after a recovery
2) The max restarts limit is reached, and the default map is loaded

Changelog:
Code:

1.5
 - Messages are now logged to logs/CMR.log
 - crashmap.txt is now generated automatically
1.4.3
 - Fixed compile warnings
 - Backs up and restores nextmap on crash + recover (test feature!)
1.4.2
 - Autoconfig added. cfg/sourcemod/plugin.crashmap.cfg
1.4.1
 - Added FCVAR_DONTRECORD to version cvar
1.4
 - Added sm_crashmap_maxrestarts
 - Added support for checking if the map being changed to crashes the server
1.3
 - Changed method of enabling/disabling recover time to improve performance
 - Added sm_crashmap_interval
1.2
 - Added timelimit recovery
 - Added sm_crashmap_recovertime
1.1
 - Added log message when map is recovered on restart
1.0
 - Initial Release


exvel 08-03-2009 11:30

Re: Crashed Map Recovery
 
Good idea. :)
You can also save timelimit.

crazydog 08-03-2009 11:45

Re: Crashed Map Recovery
 
Quote:

Originally Posted by exvel (Post 889218)
Good idea. :)
You can also save timelimit.

That's also a good idea. :P

After writing this plugin I'm surprised it hasn't already been written.

Edit:
Do you mean timeleft? or mp_timelimit?

I can't save the timeleft since the server would have crashed.
I don't think I need to save mp_timelimit, since I'd have to assume most people have mp_timelimit set in some config.

Sexual Harassment Panda 08-03-2009 22:18

Re: Crashed Map Recovery
 
oh wow amazing idea crazydog. will install immediately.

exvel 08-04-2009 04:17

Re: Crashed Map Recovery
 
Quote:

Originally Posted by crazydog (Post 889233)
Do you mean timeleft? or mp_timelimit?

I can't save the timeleft since the server would have crashed.
I don't think I need to save mp_timelimit, since I'd have to assume most people have mp_timelimit set in some config.

I see the way how do it. You can save timeleft with GetMapTimeLeft each 20 seconds than after crash and server restart just set convar mp_timeleft to the latest saved time.

crazydog 08-04-2009 04:36

Re: Crashed Map Recovery
 
I really don't like timers, as things happening repeatedly always makes me worry about performance, but I guess I'll put it in.

v. 1.2 up. Includes support for saving timelimit.

Chris-_- 08-04-2009 11:22

Re: Crashed Map Recovery
 
I'm surprised no one has made this till now : o

Doc-Holiday 08-05-2009 04:31

Re: Crashed Map Recovery
 
How ever server doc has an option when server crashes to go back the map it was on right or does it go back just to a certain map?

retsam 08-05-2009 05:04

Re: Crashed Map Recovery
 
Yeah id have to agree. Amazing this hasnt been created yet. Definitely useful. Good work.

Timiditas 08-05-2009 05:14

Re: Crashed Map Recovery
 
Great idea. However...
What if the server crashed *because* of a certain map? Then it would repeatedly crash over and over. Any way to detect that?

Maybe you could count if the server has crashed for more than X times in a preset amount of time and if yes, do not change to the last map but to a random one. (This should be logged also)


All times are GMT -4. The time now is 10:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.