[quake3-commits] r2284 - in trunk: . code/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Jun 19 11:52:09 EDT 2012
Author: ztm
Date: 2012-06-19 11:52:08 -0400 (Tue, 19 Jun 2012)
New Revision: 2284
Modified:
trunk/README
trunk/code/server/sv_ccmds.c
Log:
Added kicknum, kickall, and kickbots commands, patch by Ensiform.
Modified: trunk/README
===================================================================
--- trunk/README 2012-06-19 15:14:57 UTC (rev 2283)
+++ trunk/README 2012-06-19 15:52:08 UTC (rev 2284)
@@ -300,6 +300,12 @@
execq <filename> - quiet exec command, doesn't print "execing file.cfg"
+ kicknum <client number> - kick a client by number, same as clientkick command
+ kickall - kick all clients, similar to "kick all" (but kicks
+ everyone even if someone is named "all")
+ kickbots - kick all bots, similar to "kick allbots" (but kicks
+ all bots even if someone is named "allbots")
+
tell <client num> <msg> - send message to a single client (new to server)
Modified: trunk/code/server/sv_ccmds.c
===================================================================
--- trunk/code/server/sv_ccmds.c 2012-06-19 15:14:57 UTC (rev 2283)
+++ trunk/code/server/sv_ccmds.c 2012-06-19 15:52:08 UTC (rev 2284)
@@ -361,7 +361,7 @@
==================
SV_Kick_f
-Kick a user off of the server FIXME: move to game
+Kick a user off of the server
==================
*/
static void SV_Kick_f( void ) {
@@ -408,7 +408,7 @@
return;
}
if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) {
- SV_SendServerCommand(NULL, "print \"%s\"", "Cannot kick host player\n");
+ Com_Printf("Cannot kick host player\n");
return;
}
@@ -416,6 +416,101 @@
cl->lastPacketTime = svs.time; // in case there is a funny zombie
}
+/*
+==================
+SV_KickBots_f
+
+Kick all bots off of the server
+==================
+*/
+static void SV_KickBots_f( void ) {
+ client_t *cl;
+ int i;
+
+ // make sure server is running
+ if( !com_sv_running->integer ) {
+ Com_Printf("Server is not running.\n");
+ return;
+ }
+
+ for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ ) {
+ if( !cl->state ) {
+ continue;
+ }
+
+ if( cl->netchan.remoteAddress.type != NA_BOT ) {
+ continue;
+ }
+
+ SV_DropClient( cl, "was kicked" );
+ cl->lastPacketTime = svs.time; // in case there is a funny zombie
+ }
+}
+/*
+==================
+SV_KickAll_f
+
+Kick all users off of the server
+==================
+*/
+static void SV_KickAll_f( void ) {
+ client_t *cl;
+ int i;
+
+ // make sure server is running
+ if( !com_sv_running->integer ) {
+ Com_Printf( "Server is not running.\n" );
+ return;
+ }
+
+ for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ ) {
+ if( !cl->state ) {
+ continue;
+ }
+
+ if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) {
+ continue;
+ }
+
+ SV_DropClient( cl, "was kicked" );
+ cl->lastPacketTime = svs.time; // in case there is a funny zombie
+ }
+}
+
+/*
+==================
+SV_KickNum_f
+
+Kick a user off of the server
+==================
+*/
+static void SV_KickNum_f( void ) {
+ client_t *cl;
+
+ // make sure server is running
+ if ( !com_sv_running->integer ) {
+ Com_Printf( "Server is not running.\n" );
+ return;
+ }
+
+ if ( Cmd_Argc() != 2 ) {
+ Com_Printf ("Usage: %s <client number>\n", Cmd_Argv(0));
+ return;
+ }
+
+ cl = SV_GetPlayerByNum();
+ if ( !cl ) {
+ return;
+ }
+ if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) {
+ Com_Printf("Cannot kick host player\n");
+ return;
+ }
+
+ SV_DropClient( cl, "was kicked" );
+ cl->lastPacketTime = svs.time; // in case there is a funny zombie
+}
+
#ifndef STANDALONE
// these functions require the auth server which of course is not available anymore for stand-alone games.
@@ -448,7 +543,7 @@
}
if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) {
- SV_SendServerCommand(NULL, "print \"%s\"", "Cannot kick host player\n");
+ Com_Printf("Cannot kick host player\n");
return;
}
@@ -502,7 +597,7 @@
return;
}
if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) {
- SV_SendServerCommand(NULL, "print \"%s\"", "Cannot kick host player\n");
+ Com_Printf("Cannot kick host player\n");
return;
}
@@ -1023,40 +1118,6 @@
}
/*
-==================
-SV_ClientKick_f
-
-Kick a user off of the server FIXME: move to game
-==================
-*/
-static void SV_ClientKick_f( void ) {
- client_t *cl;
-
- // make sure server is running
- if ( !com_sv_running->integer ) {
- Com_Printf( "Server is not running.\n" );
- return;
- }
-
- if ( Cmd_Argc() != 2 ) {
- Com_Printf ("Usage: clientkick <client number>\n");
- return;
- }
-
- cl = SV_GetPlayerByNum();
- if ( !cl ) {
- return;
- }
- if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) {
- SV_SendServerCommand(NULL, "print \"%s\"", "Cannot kick host player\n");
- return;
- }
-
- SV_DropClient( cl, "was kicked" );
- cl->lastPacketTime = svs.time; // in case there is a funny zombie
-}
-
-/*
================
SV_Status_f
================
@@ -1246,7 +1307,7 @@
===========
SV_DumpUser_f
-Examine all a users info strings FIXME: move to game
+Examine all a users info strings
===========
*/
static void SV_DumpUser_f( void ) {
@@ -1318,7 +1379,10 @@
Cmd_AddCommand ("banClient", SV_BanNum_f);
}
#endif
- Cmd_AddCommand ("clientkick", SV_ClientKick_f);
+ Cmd_AddCommand ("kickbots", SV_KickBots_f);
+ Cmd_AddCommand ("kickall", SV_KickAll_f);
+ Cmd_AddCommand ("kicknum", SV_KickNum_f);
+ Cmd_AddCommand ("clientkick", SV_KickNum_f); // Legacy command
Cmd_AddCommand ("status", SV_Status_f);
Cmd_AddCommand ("serverinfo", SV_Serverinfo_f);
Cmd_AddCommand ("systeminfo", SV_Systeminfo_f);
@@ -1360,6 +1424,10 @@
// removing these won't let the server start again
Cmd_RemoveCommand ("heartbeat");
Cmd_RemoveCommand ("kick");
+ Cmd_RemoveCommand ("kicknum");
+ Cmd_RemoveCommand ("clientkick");
+ Cmd_RemoveCommand ("kickall");
+ Cmd_RemoveCommand ("kickbots");
Cmd_RemoveCommand ("banUser");
Cmd_RemoveCommand ("banClient");
Cmd_RemoveCommand ("status");
More information about the quake3-commits
mailing list