aboutsummaryrefslogtreecommitdiff
path: root/scripting/yuuko_maptimer.sp
diff options
context:
space:
mode:
Diffstat (limited to 'scripting/yuuko_maptimer.sp')
-rw-r--r--scripting/yuuko_maptimer.sp81
1 files changed, 81 insertions, 0 deletions
diff --git a/scripting/yuuko_maptimer.sp b/scripting/yuuko_maptimer.sp
new file mode 100644
index 0000000..a90222f
--- /dev/null
+++ b/scripting/yuuko_maptimer.sp
@@ -0,0 +1,81 @@
+#include <sourcemod>
+#include <console>
+#include <timers>
+
+public Plugin myinfo = {
+ name = "yuuko's map timer commands",
+ author = "yuuko",
+ description = "exposes the map-related bits of <timers> to the console",
+ version = SOURCEMOD_VERSION,
+ url = "https://www.partyvan.io/"
+};
+
+public Action Command_ExtendMapTimeLimit(int client, int args)
+{
+ if (args != 1) {
+ PrintToConsole(client, "Usage: sm_extendmaptimelimit <seconds>");
+ return Plugin_Handled;
+ }
+ int seconds = 0;
+ if (!GetCmdArgIntEx(1, seconds)) {
+ PrintToConsole(client, "argument must be an integer");
+ return Plugin_Handled;
+ }
+ if (!ExtendMapTimeLimit(seconds)) {
+ PrintToConsole(client, "operation not supported");
+ return Plugin_Handled;
+ }
+ PrintToConsole(client, "map time limit extended");
+ return Plugin_Handled;
+}
+
+public Action Command_GetMapTimeLimit(int client, int args)
+{
+ if (args != 0) {
+ PrintToConsole(client, "Usage: sm_getmaptimelimit");
+ return Plugin_Handled;
+ }
+ int minutes = 0;
+ if (!GetMapTimeLimit(minutes)) {
+ PrintToConsole(client, "operation not supported");
+ return Plugin_Handled;
+ }
+ PrintToConsole(client, "%d", minutes);
+ return Plugin_Handled;
+}
+
+public Action Command_GetMapTimeLeft(int client, int args)
+{
+ if (args != 0) {
+ PrintToConsole(client, "Usage: sm_getmaptimeleft");
+ return Plugin_Handled;
+ }
+ int seconds = 0;
+ if (!GetMapTimeLeft(seconds)) {
+ PrintToConsole(client, "operation not supported");
+ return Plugin_Handled;
+ }
+ PrintToConsole(client, "%d", seconds);
+ return Plugin_Handled;
+}
+
+public void OnPluginStart()
+{
+ RegAdminCmd(
+ "sm_extendmaptimelimit",
+ Command_ExtendMapTimeLimit,
+ ADMFLAG_CHANGEMAP,
+ "extend map time limit by argv[1] seconds"
+ );
+ RegConsoleCmd(
+ "sm_getmaptimelimit",
+ Command_GetMapTimeLimit,
+ "get map time limit, in minutes for some reason (api docs are a lie)"
+ );
+ RegConsoleCmd(
+ "sm_getmaptimeleft",
+ Command_GetMapTimeLeft,
+ "get (approximate) time left out of map time limit, in seconds"
+ );
+}
+