/* =================== Nolla - noVoteLimit XXX setup - convert to a referee command =================== */ void Svcmd_noVoteLimit() { gclient_t *cl; char name[MAX_TOKEN_CHARS]; trap_Argv(1, name, sizeof(name)); if ((cl = G_GetPlayerByName(name)) == NULL) return; if (cl->sess.noVoteLimit) cl->sess.noVoteLimit = qfalse; else { cl->pers.voteCount = 0; cl->sess.noVoteLimit = qtrue; CPx(cl - level.clients, "cpm \"^7You have not any vote limit now!\n\""); } }
static void Svcmd_Kick_f( void ) { gclient_t *cl; int i; int timeout = -1; char sTimeout[MAX_TOKEN_CHARS]; char name[MAX_TOKEN_CHARS]; // make sure server is running if ( !G_Is_SV_Running() ) { G_Printf( "Server is not running.\n" ); return; } if ( trap_Argc() < 2 || trap_Argc() > 3 ) { G_Printf ("Usage: kick <player name> [timeout]\n"); return; } if( trap_Argc() == 3 ) { trap_Argv( 2, sTimeout, sizeof( sTimeout ) ); timeout = atoi( sTimeout ); } else { timeout = 300; } trap_Argv(1, name, sizeof(name)); cl = G_GetPlayerByName( name );//ClientForString( name ); if ( !cl ) { if ( !Q_stricmp(name, "all") ) { for (i = 0, cl = level.clients; i < level.numConnectedClients; i++, cl++) { // dont kick localclients ... if ( cl->pers.localClient ) { continue; } if ( timeout != -1 ) { char *ip; char userinfo[MAX_INFO_STRING]; trap_GetUserinfo( cl->ps.clientNum, userinfo, sizeof( userinfo ) ); ip = Info_ValueForKey (userinfo, "ip"); // use engine banning system, mods may choose to use their own banlist if (USE_ENGINE_BANLIST) { // kick but dont ban bots, they arent that lame if ( (g_entities[cl->ps.clientNum].r.svFlags & SVF_BOT) ) { timeout = 0; } trap_DropClient(cl->ps.clientNum, "player kicked", timeout); } else { trap_DropClient(cl->ps.clientNum, "player kicked", 0); // kick but dont ban bots, they arent that lame if ( !(g_entities[cl->ps.clientNum].r.svFlags & SVF_BOT) ) AddIPBan( ip ); } } else { trap_DropClient(cl->ps.clientNum, "player kicked", 0); } } } #ifndef NO_BOT_SUPPORT else if ( !Q_stricmp(name, "allbots") ) { for (i = 0, cl = level.clients; i < level.numConnectedClients; i++, cl++) { if ( !(g_entities[cl->ps.clientNum].r.svFlags & SVF_BOT) ) { continue; } // kick but dont ban bots, they arent that lame trap_DropClient(cl->ps.clientNum, "player kicked", 0); } } #endif return; } else { // dont kick localclients ... if ( cl->pers.localClient ) { G_Printf("Cannot kick host player\n"); return; } if ( timeout != -1 ) { char *ip; char userinfo[MAX_INFO_STRING]; trap_GetUserinfo( cl->ps.clientNum, userinfo, sizeof( userinfo ) ); ip = Info_ValueForKey (userinfo, "ip"); // use engine banning system, mods may choose to use their own banlist if (USE_ENGINE_BANLIST) { // kick but dont ban bots, they arent that lame if ( (g_entities[cl->ps.clientNum].r.svFlags & SVF_BOT) ) { timeout = 0; } trap_DropClient(cl->ps.clientNum, "player kicked", timeout); } else { trap_DropClient(cl->ps.clientNum, "player kicked", 0); // kick but dont ban bots, they arent that lame if ( !(g_entities[cl->ps.clientNum].r.svFlags & SVF_BOT) ) AddIPBan( ip ); } } else { trap_DropClient(cl->ps.clientNum, "player kicked", 0); } } }