summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-global/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-global/commands.sp
parent38f1140c11724da05a23a10385061200b907cf6e (diff)
bbbbbbbbwaaaaaaaaaaa
Diffstat (limited to 'sourcemod/scripting/gokz-global/commands.sp')
-rw-r--r--sourcemod/scripting/gokz-global/commands.sp169
1 files changed, 169 insertions, 0 deletions
diff --git a/sourcemod/scripting/gokz-global/commands.sp b/sourcemod/scripting/gokz-global/commands.sp
new file mode 100644
index 0000000..8ee7c32
--- /dev/null
+++ b/sourcemod/scripting/gokz-global/commands.sp
@@ -0,0 +1,169 @@
+void RegisterCommands()
+{
+ RegConsoleCmd("sm_globalcheck", CommandGlobalCheck, "[KZ] Show whether global records are currently enabled in chat.");
+ RegConsoleCmd("sm_gc", CommandGlobalCheck, "[KZ] Show whether global records are currently enabled in chat.");
+ RegConsoleCmd("sm_tier", CommandTier, "[KZ] Show the map's tier in chat.");
+ RegConsoleCmd("sm_gpb", CommandPrintPBs, "[KZ] Show main course global personal best in chat. Usage: !gpb <map>");
+ RegConsoleCmd("sm_gr", CommandPrintRecords, "[KZ] Show main course global record times in chat. Usage: !gr <map>");
+ RegConsoleCmd("sm_gwr", CommandPrintRecords, "[KZ] Show main course global record times in chat. Usage: !gwr <map>");
+ RegConsoleCmd("sm_gbpb", CommandPrintBonusPBs, "[KZ] Show bonus global personal best in chat. Usage: !gbpb <#bonus> <map>");
+ RegConsoleCmd("sm_gbr", CommandPrintBonusRecords, "[KZ] Show bonus global record times in chat. Usage: !bgr <#bonus> <map>");
+ RegConsoleCmd("sm_gbwr", CommandPrintBonusRecords, "[KZ] Show bonus global record times in chat. Usage: !bgwr <#bonus> <map>");
+ RegConsoleCmd("sm_gmaptop", CommandMapTop, "[KZ] Open a menu showing the top global main course times of a map. Usage: !gmaptop <map>");
+ RegConsoleCmd("sm_gbmaptop", CommandBonusMapTop, "[KZ] Open a menu showing the top global bonus times of a map. Usage: !gbmaptop <#bonus> <map>");
+}
+
+public Action CommandGlobalCheck(int client, int args)
+{
+ PrintGlobalCheckToChat(client);
+ return Plugin_Handled;
+}
+
+public Action CommandTier(int client, int args)
+{
+ if (gI_MapTier != -1)
+ {
+ GOKZ_PrintToChat(client, true, "%t", "Map Tier", gC_CurrentMap, gI_MapTier);
+ }
+ else
+ {
+ GOKZ_PrintToChat(client, true, "%t", "Map Tier (Unknown)", gC_CurrentMap);
+ }
+ return Plugin_Handled;
+}
+
+public Action CommandPrintPBs(int client, int args)
+{
+ char steamid[32];
+ GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));
+ return CommandPrintRecordsHelper(client, args, steamid);
+}
+
+public Action CommandPrintRecords(int client, int args)
+{
+ return CommandPrintRecordsHelper(client, args);
+}
+
+static Action CommandPrintRecordsHelper(int client, int args, const char[] steamid = DEFAULT_STRING)
+{
+ KZPlayer player = KZPlayer(client);
+ int mode = player.Mode;
+
+ if (args == 0)
+ { // Print record times for current map and their current mode
+ PrintRecords(client, gC_CurrentMap, 0, mode, steamid);
+ }
+ else if (args >= 1)
+ { // Print record times for specified map and their current mode
+ char argMap[33];
+ GetCmdArg(1, argMap, sizeof(argMap));
+ PrintRecords(client, argMap, 0, mode, steamid);
+ }
+ return Plugin_Handled;
+}
+
+public Action CommandPrintBonusPBs(int client, int args)
+{
+ char steamid[32];
+ GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));
+ return CommandPrintBonusRecordsHelper(client, args, steamid);
+}
+
+public Action CommandPrintBonusRecords(int client, int args)
+{
+ return CommandPrintBonusRecordsHelper(client, args);
+}
+
+static Action CommandPrintBonusRecordsHelper(int client, int args, const char[] steamid = DEFAULT_STRING)
+{
+ KZPlayer player = KZPlayer(client);
+ int mode = player.Mode;
+
+ if (args == 0)
+ { // Print Bonus 1 record times for current map and their current mode
+ PrintRecords(client, gC_CurrentMap, 1, mode, steamid);
+ }
+ else if (args == 1)
+ { // Print specified Bonus # record times for current map and their current mode
+ char argBonus[4];
+ GetCmdArg(1, argBonus, sizeof(argBonus));
+ int bonus = StringToInt(argBonus);
+ if (GOKZ_IsValidCourse(bonus, true))
+ {
+ PrintRecords(client, gC_CurrentMap, bonus, mode, steamid);
+ }
+ else
+ {
+ GOKZ_PrintToChat(client, true, "%t", "Invalid Bonus Number", argBonus);
+ }
+ }
+ else if (args >= 2)
+ { // Print specified Bonus # record times for specified map and their current mode
+ char argBonus[4], argMap[33];
+ GetCmdArg(1, argBonus, sizeof(argBonus));
+ GetCmdArg(2, argMap, sizeof(argMap));
+ int bonus = StringToInt(argBonus);
+ if (GOKZ_IsValidCourse(bonus, true))
+ {
+ PrintRecords(client, argMap, bonus, mode, steamid);
+ }
+ else
+ {
+ GOKZ_PrintToChat(client, true, "%t", "Invalid Bonus Number", argBonus);
+ }
+ }
+ return Plugin_Handled;
+}
+
+public Action CommandMapTop(int client, int args)
+{
+ if (args <= 0)
+ { // Open global map top for current map
+ DisplayMapTopModeMenu(client, gC_CurrentMap, 0);
+ }
+ else if (args >= 1)
+ { // Open global map top for specified map
+ char argMap[64];
+ GetCmdArg(1, argMap, sizeof(argMap));
+ DisplayMapTopModeMenu(client, argMap, 0);
+ }
+ return Plugin_Handled;
+}
+
+public Action CommandBonusMapTop(int client, int args)
+{
+ if (args == 0)
+ { // Open global Bonus 1 top for current map
+ DisplayMapTopModeMenu(client, gC_CurrentMap, 1);
+ }
+ else if (args == 1)
+ { // Open specified global Bonus # top for current map
+ char argBonus[4];
+ GetCmdArg(1, argBonus, sizeof(argBonus));
+ int bonus = StringToInt(argBonus);
+ if (GOKZ_IsValidCourse(bonus, true))
+ {
+ DisplayMapTopModeMenu(client, gC_CurrentMap, bonus);
+ }
+ else
+ {
+ GOKZ_PrintToChat(client, true, "%t", "Invalid Bonus Number", argBonus);
+ }
+ }
+ else if (args >= 2)
+ { // Open specified global Bonus # top for specified map
+ char argBonus[4], argMap[33];
+ GetCmdArg(1, argBonus, sizeof(argBonus));
+ GetCmdArg(2, argMap, sizeof(argMap));
+ int bonus = StringToInt(argBonus);
+ if (GOKZ_IsValidCourse(bonus, true))
+ {
+ DisplayMapTopModeMenu(client, argMap, bonus);
+ }
+ else
+ {
+ GOKZ_PrintToChat(client, true, "%t", "Invalid Bonus Number", argBonus);
+ }
+ }
+ return Plugin_Handled;
+}