const char *SP_GetStringTextString(const char *Reference) { int index; index = SP_GetStringID(Reference); if (index == -1) { return ""; } return SP_GetStringText(index); }
/* ================ SV_Status_f ================ */ static void SV_Status_f( void ) { int i; client_t *cl; playerState_t *ps; const char *s; int ping; char state[32]; qboolean avoidTruncation = qfalse; int j, k; char spaces[32]; char displayName[MAX_NAME_LENGTH]; // make sure server is running if ( !com_sv_running->integer ) { Com_Printf( SP_GetStringText(STR_SERVER_SERVER_NOT_RUNNING) ); return; } if ( Cmd_Argc() > 1 ) { if (!Q_stricmp("notrunc", Cmd_Argv(1))) { avoidTruncation = qtrue; } } Com_Printf ("map: %s\n", sv_mapname->string ); Com_Printf ("num score ping name lastmsg address qport rate\n"); Com_Printf ("--- ----- ---- --------------- ------- --------------------- ----- -----\n"); for (i=0,cl=svs.clients ; i < sv_maxclients->integer ; i++,cl++) { if (!cl->state) { continue; } if (cl->state == CS_CONNECTED) { strcpy(state, "CNCT "); } else if (cl->state == CS_ZOMBIE) { strcpy(state, "ZMBI "); } else { ping = cl->ping < 9999 ? cl->ping : 9999; sprintf(state, "%4i", ping); } ps = SV_GameClientNum( i ); s = NET_AdrToString( cl->netchan.remoteAddress ); // Count the length of the visible characters in the name and if it's less than 15 fill the rest with spaces k = MV_StrlenSkipColors(cl->name); if ( k < 0 ) k = 0; // Should never happen for( j = 0; j < (15 - k); j++ ) spaces[j] = ' '; spaces[j] = 0; if (!avoidTruncation) MV_CopyStringWithColors( cl->name, displayName, sizeof(displayName), 15 ); // Limit the visible length of the name to 15 characters (not counting colors) else Q_strncpyz( displayName, cl->name, sizeof(displayName) ); Com_Printf ("%3i %5i %s %s^7%s %7i %21s %5i %5i\n", i, ps->persistant[PERS_SCORE], state, displayName, spaces, svs.time - cl->lastPacketTime, s, cl->netchan.qport, cl->rate ); } Com_Printf ("\n"); }