MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SV_SendServerCommand

Function SV_SendServerCommand

code/server/sv_main.cpp:123–155  ·  view source on GitHub ↗

================= SV_SendServerCommand Sends a reliable command string to be interpreted by the client game module: "cp", "print", "chat", etc A NULL client will broadcast to all clients ================= */

Source from the content-addressed store, hash-verified

121=================
122*/
123void SV_SendServerCommand(client_t *cl, const char *fmt, ...) {
124 va_list argptr;
125 byte message[MAX_MSGLEN];
126 client_t *client;
127 int j;
128
129 message[0] = svc_serverCommand;
130
131 va_start (argptr,fmt);
132 Q_vsnprintf( (char *)message+1, sizeof(message)-1, fmt, argptr );
133 va_end (argptr);
134
135 // Fix to http://aluigi.altervista.org/adv/q3msgboom-adv.txt
136 // The actual cause of the bug is probably further downstream
137 // and should maybe be addressed later, but this certainly
138 // fixes the problem for now
139 if ( strlen ((char *)message+1) > 1022 ) {
140 return;
141 }
142
143 if ( cl != NULL ) {
144 SV_AddServerCommand( cl, (char *)message );
145 return;
146 }
147
148 // send the data to all relevent clients
149 for (j = 0, client = svs.clients; j < 1 ; j++, client++) {
150 if ( client->state < CS_PRIMED ) {
151 continue;
152 }
153 SV_AddServerCommand( client, (char *)message );
154 }
155}
156
157
158

Callers 4

SV_DropClientFunction · 0.70
SV_SetConfigstringFunction · 0.70
SV_FinalMessageFunction · 0.70
SV_GameSendServerCommandFunction · 0.70

Calls 2

Q_vsnprintfFunction · 0.85
SV_AddServerCommandFunction · 0.70

Tested by

no test coverage detected