/* =============== SVC_RemoteCommand A client issued an rcon command. Shift down the remaining args Redirect all printfs =============== */ static void SVC_RemoteCommand (void) { int i; char remaining[1024]; i = Rcon_Validate (); if (i == 0) { Con_Printf ("Bad rcon from %s:\n%s\n", NET_AdrToString(net_from), net_message.data + 4); SV_BeginRedirect (RD_PACKET); Con_Printf ("Bad rcon_password.\n"); } else { Con_Printf ("Rcon from %s:\n%s\n", NET_AdrToString(net_from), net_message.data + 4); SV_BeginRedirect (RD_PACKET); remaining[0] = 0; for (i = 2; i < Cmd_Argc(); i++) { strcat (remaining, Cmd_Argv(i) ); strcat (remaining, " "); } Cmd_ExecuteString (remaining, src_command); } SV_EndRedirect (); }
/* ================ SVC_Status Responds with all the info that qplug or qspy can see This message can be up to around 5k with worst case string lengths. ================ */ void SVC_Status (void) { int i; client_t *cl; int ping; int top, bottom; SV_BeginRedirect (RD_PACKET); Com_Printf ("%s\n", svs.info); for (i=0 ; i<MAX_CLIENTS ; i++) { cl = &svs.clients[i]; if ((cl->state == cs_connected || cl->state == cs_spawned ) && !cl->spectator) { top = atoi(Info_ValueForKey (cl->userinfo, "topcolor")); bottom = atoi(Info_ValueForKey (cl->userinfo, "bottomcolor")); top = (top < 0) ? 0 : ((top > 13) ? 13 : top); bottom = (bottom < 0) ? 0 : ((bottom > 13) ? 13 : bottom); ping = SV_CalcPing (cl); Com_Printf ("%i %i %i %i \"%s\" \"%s\" %i %i\n", cl->userid, cl->old_frags, (int)(svs.realtime - cl->connection_started)/60, ping, cl->name, Info_ValueForKey (cl->userinfo, "skin"), top, bottom); } } SV_EndRedirect (); }
/* =============== SVC_RemoteCommand A client issued an rcon command. Shift down the remaining args Redirect all printfs =============== */ void SVC_RemoteCommand (void) { if (!Rcon_Validate ()) { Com_Printf ("Bad rcon from %s:\n%s\n", NET_AdrToString (net_from), net_message.data+4); SV_BeginRedirect (RD_PACKET); Com_Printf ("Bad rcon_password\n"); } else { Com_Printf ("Rcon from %s:\n%s\n", NET_AdrToString (net_from), net_message.data+4); SV_BeginRedirect (RD_PACKET); Cmd_ExecuteString (Cmd_MakeArgs(2)); } SV_EndRedirect (); }
void SV_ExecuteUserCommand (char *s) { ucmd_t *u; Cmd_TokenizeString (s); sv_player = host_client->edict; SV_BeginRedirect (RD_CLIENT); for (u=ucmds ; u->name ; u++) if (!strcmp (Cmd_Argv(0), u->name) ) { u->func (); break; } if (!u->name) Con_Printf ("Bad user command: %s\n", Cmd_Argv(0)); SV_EndRedirect (); }