set timelimit_decrement 5
set timelimit_min 5
set timelimit_max 60
-alias extendmatchtime "sv_cmd rpn /timelimit timelimit timelimit_max timelimit timelimit_increment add bound def"
-alias reducematchtime "sv_cmd rpn /timelimit timelimit timelimit_decrement sub timelimit_min timelimit bound def"
+alias extendmatchtime "sv_cmd extendmatchtime"
+alias reducematchtime "sv_cmd reducematchtime"
alias endmatch "timelimit -1"
// useful keybind to maximize the chat area temporarily
float autocvar_teamplay_mode;
#define autocvar_timelimit cvar("timelimit")
#define autocvar_timelimit_override cvar("timelimit_override")
+float autocvar_timelimit_increment;
+float autocvar_timelimit_decrement;
+float autocvar_timelimit_min;
+float autocvar_timelimit_max;
float autocvar_timelimit_overtime;
float autocvar_timelimit_overtimes;
float autocvar_timelimit_suddendeath;
}
}
+void changematchtime(float delta, float mi, float ma)
+{
+ float cur;
+ float new;
+ float lim;
+
+ if(delta == 0)
+ return;
+ if(autocvar_timelimit < 0)
+ return;
+
+ if(mi <= 10)
+ mi = 10; // at least ten sec in the future
+ cur = time - game_starttime;
+ if(cur > 0)
+ mi += cur; // from current time!
+
+ lim = autocvar_timelimit * 60;
+
+ if(delta > 0)
+ {
+ if(lim == 0)
+ return; // cannot increase any further
+ else if(lim < ma)
+ new = min(ma, lim + delta);
+ else // already above maximum: FAIL
+ return;
+ }
+ else
+ {
+ if(lim == 0) // infinite: try reducing to max, if we are allowed to
+ new = max(mi, ma);
+ else if(lim > mi) // above minimum: decrease
+ new = max(mi, lim + delta);
+ else // already below minimum: FAIL
+ return;
+ }
+
+ cvar_set("timelimit", ftos(new));
+}
+
void GameCommand(string command)
{
float argc;
print(" cvar_changes\n");
print(" cvar_purechanges\n");
print(" find classname\n");
+ print(" extendmatchtime\n");
+ print(" reducematchtime\n");
GameCommand_Vote("help", world);
GameCommand_Ban("help");
GameCommand_Generic("help");
return;
}
+ if(argv(0) == "extendmatchtime")
+ {
+ changematchtime(autocvar_timelimit_increment* 60, autocvar_timelimit_min*60, autocvar_timelimit_max*60);
+ return;
+ }
+
+ if(argv(0) == "reducematchtime")
+ {
+ changematchtime(autocvar_timelimit_decrement*-60, autocvar_timelimit_min*60, autocvar_timelimit_max*60);
+ return;
+ }
+
print("Invalid command. For a list of supported commands, try sv_cmd help.\n");
}