summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-replays/commands.sp
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-12-04 18:06:10 +0100
committernavewindre <nw@moneybot.cc>2023-12-04 18:06:10 +0100
commitaef0d1c1268ab7d4bc18996c9c6b4da16a40aadc (patch)
tree43e766b51704f4ab8b383583bdc1871eeeb9c698 /sourcemod/scripting/gokz-replays/commands.sp
parent38f1140c11724da05a23a10385061200b907cf6e (diff)
bbbbbbbbwaaaaaaaaaaa
Diffstat (limited to 'sourcemod/scripting/gokz-replays/commands.sp')
-rw-r--r--sourcemod/scripting/gokz-replays/commands.sp55
1 files changed, 55 insertions, 0 deletions
diff --git a/sourcemod/scripting/gokz-replays/commands.sp b/sourcemod/scripting/gokz-replays/commands.sp
new file mode 100644
index 0000000..43251f6
--- /dev/null
+++ b/sourcemod/scripting/gokz-replays/commands.sp
@@ -0,0 +1,55 @@
+void RegisterCommands()
+{
+ RegConsoleCmd("sm_replay", CommandReplay, "[KZ] Open the replay loading menu.");
+ RegConsoleCmd("sm_replaycontrols", CommandReplayControls, "[KZ] Toggle the replay control menu.");
+ RegConsoleCmd("sm_rpcontrols", CommandReplayControls, "[KZ] Toggle the replay control menu.");
+ RegConsoleCmd("sm_replaygoto", CommandReplayGoto, "[KZ] Skip to a specific time in the replay (hh:mm:ss).");
+ RegConsoleCmd("sm_rpgoto", CommandReplayGoto, "[KZ] Skip to a specific time in the replay (hh:mm:ss).");
+}
+
+public Action CommandReplay(int client, int args)
+{
+ DisplayReplayModeMenu(client);
+ return Plugin_Handled;
+}
+
+public Action CommandReplayControls(int client, int args)
+{
+ ToggleReplayControls(client);
+ return Plugin_Handled;
+}
+
+public Action CommandReplayGoto(int client, int args)
+{
+ int seconds;
+ char timeString[32], split[3][32];
+
+ GetCmdArgString(timeString, sizeof(timeString));
+ int res = ExplodeString(timeString, ":", split, 3, 32, false);
+ switch (res)
+ {
+ case 1:
+ {
+ seconds = StringToInt(split[0]);
+ }
+
+ case 2:
+ {
+ seconds = StringToInt(split[0]) * 60 + StringToInt(split[1]);
+ }
+
+ case 3:
+ {
+ seconds = StringToInt(split[0]) * 3600 + StringToInt(split[1]) * 60 + StringToInt(split[2]);
+ }
+
+ default:
+ {
+ GOKZ_PrintToChat(client, true, "%t", "Replay Controls - Invalid Time");
+ return Plugin_Handled;
+ }
+ }
+
+ TrySkipToTime(client, seconds);
+ return Plugin_Handled;
+}