]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host_cmd.c
ping command now works from server console
[xonotic/darkplaces.git] / host_cmd.c
index 2ad0a7bc51845c0ae25c018328dc6d98639fd959..be312bf8880529ca51392b623cdcf35c8c4838e1 100644 (file)
@@ -209,21 +209,28 @@ Host_Ping_f
 */
 void Host_Ping_f (void)
 {
-       int             i;
-       client_t        *client;
+       int i;
+       client_t *client;
+       void (*print) (const char *fmt, ...);
 
        if (cmd_source == src_command)
        {
-               Cmd_ForwardToServer ();
-               return;
+               if (!sv.active)
+               {
+                       Cmd_ForwardToServer ();
+                       return;
+               }
+               print = Con_Printf;
        }
+       else
+               print = SV_ClientPrintf;
 
-       SV_ClientPrint("Client ping times:\n");
+       print("Client ping times:\n");
        for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
        {
                if (!client->active)
                        continue;
-               SV_ClientPrintf("%4i %s\n", (int)floor(client->ping*1000+0.5), client->name);
+               print("%4i %s\n", (int)floor(client->ping*1000+0.5), client->name);
        }
 }
 
@@ -1303,9 +1310,6 @@ void Host_Spawn_f (void)
        }
        else
        {
-               // set up the edict
-               PRVM_ED_ClearEdict(host_client->edict);
-
                //Con_Printf("Host_Spawn_f: host_client->edict->netname = %s, host_client->edict->netname = %s, host_client->name = %s\n", PRVM_GetString(host_client->edict->fields.server->netname), PRVM_GetString(host_client->edict->fields.server->netname), host_client->name);
 
                // copy spawn parms out of the client_t