mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 05:52:03 +00:00
Added kicknum, kickall, and kickbots commands, patch by Ensiform.
This commit is contained in:
parent
945f01d4af
commit
afa607c3b6
2 changed files with 114 additions and 40 deletions
6
README
6
README
|
@ -300,6 +300,12 @@ New commands
|
|||
|
||||
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)
|
||||
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ static void SV_MapRestart_f( void ) {
|
|||
==================
|
||||
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,102 @@ static void SV_Kick_f( void ) {
|
|||
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;
|
||||
}
|
||||
|
||||
SV_DropClient( cl, "was kicked" );
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -448,7 +543,7 @@ static void SV_Ban_f( void ) {
|
|||
}
|
||||
|
||||
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 @@ static void SV_BanNum_f( void ) {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -1022,40 +1117,6 @@ static void SV_ExceptDel_f(void)
|
|||
SV_DelBanFromList(qtrue);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
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 @@ static void SV_Systeminfo_f( void ) {
|
|||
===========
|
||||
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 @@ void SV_AddOperatorCommands( void ) {
|
|||
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 @@ void SV_RemoveOperatorCommands( void ) {
|
|||
// 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");
|
||||
|
|
Loading…
Reference in a new issue