]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
sv_ccmds: Move what are actually client commands to the client.
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 Sep 2020 19:19:08 +0000 (19:19 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 Sep 2020 19:19:08 +0000 (19:19 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12973 d7cf8633-e32d-0410-b094-e92efae38249

cl_cmd.c
sv_ccmds.c

index 569ba83472f409e353e4afbf29c22a62373c774a..862f992fb3481a3a5e56a4a96d3a833544592d18 100644 (file)
--- a/cl_cmd.c
+++ b/cl_cmd.c
@@ -295,6 +295,68 @@ static void CL_Color_f(cmd_state_t *cmd)
        }
 }
 
+/*
+====================
+CL_User_f
+
+user <name or userid>
+
+Dump userdata / masterdata for a user
+====================
+*/
+static void CL_User_f(cmd_state_t *cmd) // credit: taken from QuakeWorld
+{
+       int             uid;
+       int             i;
+
+       if (Cmd_Argc(cmd) != 2)
+       {
+               Con_Printf ("Usage: user <username / userid>\n");
+               return;
+       }
+
+       uid = atoi(Cmd_Argv(cmd, 1));
+
+       for (i = 0;i < cl.maxclients;i++)
+       {
+               if (!cl.scores[i].name[0])
+                       continue;
+               if (cl.scores[i].qw_userid == uid || !strcasecmp(cl.scores[i].name, Cmd_Argv(cmd, 1)))
+               {
+                       InfoString_Print(cl.scores[i].qw_userinfo);
+                       return;
+               }
+       }
+       Con_Printf ("User not in server.\n");
+}
+
+/*
+====================
+CL_Users_f
+
+Dump userids for all current players
+====================
+*/
+static void CL_Users_f(cmd_state_t *cmd) // credit: taken from QuakeWorld
+{
+       int             i;
+       int             c;
+
+       c = 0;
+       Con_Printf ("userid frags name\n");
+       Con_Printf ("------ ----- ----\n");
+       for (i = 0;i < cl.maxclients;i++)
+       {
+               if (cl.scores[i].name[0])
+               {
+                       Con_Printf ("%6i %4i %s\n", cl.scores[i].qw_userid, cl.scores[i].frags, cl.scores[i].name);
+                       c++;
+               }
+       }
+
+       Con_Printf ("%i total users\n", c);
+}
+
 /*
 ====================
 CL_Packet_f
@@ -661,6 +723,8 @@ void CL_InitCommands(void)
        Cmd_AddCommand(CF_CLIENT, "rcon", CL_Rcon_f, "sends a command to the server console (if your rcon_password matches the server's rcon_password), or to the address specified by rcon_address when not connected (again rcon_password must match the server's); note: if rcon_secure is set, client and server clocks must be synced e.g. via NTP");
        Cmd_AddCommand(CF_CLIENT, "srcon", CL_Rcon_f, "sends a command to the server console (if your rcon_password matches the server's rcon_password), or to the address specified by rcon_address when not connected (again rcon_password must match the server's); this always works as if rcon_secure is set; note: client and server clocks must be synced e.g. via NTP");
        Cmd_AddCommand(CF_CLIENT, "pqrcon", CL_PQRcon_f, "sends a command to a proquake server console (if your rcon_password matches the server's rcon_password), or to the address specified by rcon_address when not connected (again rcon_password must match the server's)");
+       Cmd_AddCommand(CF_SHARED, "user", CL_User_f, "prints additional information about a player number or name on the scoreboard");
+       Cmd_AddCommand(CF_SHARED, "users", CL_Users_f, "prints additional information about all players on the scoreboard");
        Cmd_AddCommand(CF_CLIENT, "packet", CL_Packet_f, "send a packet to the specified address:port containing a text string");
        Cmd_AddCommand(CF_CLIENT, "fullinfo", CL_FullInfo_f, "allows client to modify their userinfo");
        Cmd_AddCommand(CF_CLIENT, "setinfo", CL_SetInfo_f, "modifies your userinfo");
index b1d2a4e79925479b351b460601d3da5cdff25c04..125ea582582bd9fb06abca83fc45712ac78ce2c3 100644 (file)
@@ -712,68 +712,6 @@ static void SV_Pings_f(cmd_state_t *cmd)
                MSG_WriteString(&host_client->netconnection->message, "\n");
 }
 
-/*
-====================
-SV_User_f
-
-user <name or userid>
-
-Dump userdata / masterdata for a user
-====================
-*/
-static void SV_User_f(cmd_state_t *cmd) // credit: taken from QuakeWorld
-{
-       int             uid;
-       int             i;
-
-       if (Cmd_Argc(cmd) != 2)
-       {
-               Con_Printf ("Usage: user <username / userid>\n");
-               return;
-       }
-
-       uid = atoi(Cmd_Argv(cmd, 1));
-
-       for (i = 0;i < cl.maxclients;i++)
-       {
-               if (!cl.scores[i].name[0])
-                       continue;
-               if (cl.scores[i].qw_userid == uid || !strcasecmp(cl.scores[i].name, Cmd_Argv(cmd, 1)))
-               {
-                       InfoString_Print(cl.scores[i].qw_userinfo);
-                       return;
-               }
-       }
-       Con_Printf ("User not in server.\n");
-}
-
-/*
-====================
-SV_Users_f
-
-Dump userids for all current players
-====================
-*/
-static void SV_Users_f(cmd_state_t *cmd) // credit: taken from QuakeWorld
-{
-       int             i;
-       int             c;
-
-       c = 0;
-       Con_Printf ("userid frags name\n");
-       Con_Printf ("------ ----- ----\n");
-       for (i = 0;i < cl.maxclients;i++)
-       {
-               if (cl.scores[i].name[0])
-               {
-                       Con_Printf ("%6i %4i %s\n", cl.scores[i].qw_userid, cl.scores[i].frags, cl.scores[i].name);
-                       c++;
-               }
-       }
-
-       Con_Printf ("%i total users\n", c);
-}
-
 /*
 ==================
 SV_Status_f
@@ -1707,8 +1645,6 @@ void SV_InitOperatorCommands(void)
        Cmd_AddCommand(CF_SHARED, "viewnext", SV_Viewnext_f, "change to next animation frame of viewthing entity in current level");
        Cmd_AddCommand(CF_SHARED, "viewprev", SV_Viewprev_f, "change to previous animation frame of viewthing entity in current level");
        Cmd_AddCommand(CF_SHARED, "maxplayers", SV_MaxPlayers_f, "sets limit on how many players (or bots) may be connected to the server at once");
-       Cmd_AddCommand(CF_SHARED, "user", SV_User_f, "prints additional information about a player number or name on the scoreboard");
-       Cmd_AddCommand(CF_SHARED, "users", SV_Users_f, "prints additional information about all players on the scoreboard");
        Cmd_AddCommand(CF_SERVER, "sendcvar", SV_SendCvar_f, "sends the value of a cvar to the server as a sentcvar command, for use by QuakeC");
 
        // commands that do not have automatic forwarding from cmd_client, these are internal details of the network protocol and not of interest to users (if they know what they are doing they can still use a generic "cmd prespawn" or similar)