pheadxdll,
Thanks for making this and the melee only plugins, it is great to have a good one available again!
In getting this set up on a couple servers I found that melee_suddendeath *always* sets mp_stalemate_enable to 1, even if you have disabled the plugin in the map-specific .cfg file. (because the cvar is changed by the plugin after server.cfg, map-specific .cfg, and sourcemod.cfg have all run).
I've made a small patch (aside from the comments, sorry...) that places a conditional on forcing mp_stalemate_enable on, based on whether melee_suddendeath is enabled or not. If it is not enabled (say, because it's a CP map, or whatever reason the server admin doesn't want sudden death enabled in a particular map), it does not set mp_stalemate_enable to 1.
Code:
diff -up ./melee_suddendeath.sp.stalemate ./melee_suddendeath.sp
--- ./melee_suddendeath.sp.stalemate 2011-02-10 17:26:23.884960150 -0500
+++ ./melee_suddendeath.sp 2011-02-10 18:07:03.456772254 -0500
@@ -3,7 +3,7 @@
#include <tf2_stocks>
#include "melee.inc"
-#define PLUGIN_VERSION "0.1"
+#define PLUGIN_VERSION "0.1-pp1"
new Handle:g_hEnabled;
new Handle:g_hClass;
@@ -47,9 +47,35 @@ public OnMapStart()
public OnConfigsExecuted()
{
- new Handle:hCvar = FindConVar("mp_stalemate_enable");
- SetConVarInt(hCvar, 1);
- CloseHandle(hCvar);
+ /* making sure mp_stalemate_enable is on is a good idea
+ * *IF* whatever the current map is is one that you WANT
+ * going into stalemate - this may or may not be desirable
+ * to you or work very well on all types of maps - like cp
+ * maps and others with their own round/mini-round timers.
+ * Always forcing mp_stalemate_enable on, if for some reason
+ * there happens to be an mp_timelimit in effect on the map
+ * (perhaps because a default one is set in the global
+ * server.cfg, etc.), can cause a cp or other type map to go
+ * into stalemate when it is completely unexpected (going by the
+ * round/mini-round timer at the top of the screen, not by
+ * mp_timelimit which is otherwise ignored in many non-ctf maps).
+ *
+ * Since we have a plugin "enable" cvar which defines whether this
+ * plugin is even supposed to be active or not, why not use the
+ * value of this cvar to control whether we set mp_stalemate_enable
+ * to 1 or not? This way we get per-map configurability (via the
+ * map-specific .cfg file) of not only whether we want sudden death
+ * melee behavior on this map, but also whether we want
+ * mp_stalemate_enable enabled AT ALL. Otherwise mp_stalemate_enable
+ * will *ALWAYS* be set on if this plugin is loaded, even when the
+ * map-specific .cfg file explicitly turns it off!
+ */
+ if (GetConVarInt(g_hEnabled) == 1)
+ {
+ new Handle:hCvar = FindConVar("mp_stalemate_enable");
+ SetConVarInt(hCvar, 1);
+ CloseHandle(hCvar);
+ }
}
@@ -132,4 +158,4 @@ public Action:Event_SuddenDeathEnd(Handl
}
return Plugin_Continue;
-}
\ No newline at end of file
+}
The patch is also attached as a file, and the melee_suddendeath.sp file attached is a version with this patch already in it.
(If you agree this is useful or a good idea, feel free to discard all the comments haha)
Cheers,
PharaohsPaw