/////////////////////////////////////////////////////////////////////// // Remove a bot by name or all bots /////////////////////////////////////////////////////////////////////// void BOT_RemoveBot(char *name) { int i; qboolean freed=false; edict_t *bot; for(i=0;i<maxclients->value;i++) { bot = g_edicts + i + 1; if( !bot->inuse || !bot->ai ) //jabot092(2) continue; if( bot->ai->is_bot && (!strcmp(bot->client->pers.netname,name) || !strcmp(name,"all"))) { bot->health = 0; player_die (bot, bot, bot, 100000, vec3_origin); // don't even bother waiting for death frames bot->deadflag = DEAD_DEAD; bot->inuse = false; freed = true; AI_EnemyRemoved (bot); G_FreeAI( bot ); //jabot092(2) //safe_bprintf (PRINT_MEDIUM, "%s removed\n", bot->client->pers.netname); } } // if(!freed && !Q_stricmp( name, "all") ) // safe_bprintf (PRINT_MEDIUM, "%s not found\n", name); }
/* * ClientDisconnect * Called when a player drops from the server. * Will not be called between levels. */ void ClientDisconnect( edict_t *ent, const char *reason ) { int team; if( !ent->r.client || !ent->r.inuse ) return; // always report in RACE mode if( GS_RaceGametype() || ( ent->r.client->team != TEAM_SPECTATOR && ( GS_MatchState() == MATCH_STATE_PLAYTIME || GS_MatchState() == MATCH_STATE_POSTMATCH ) ) ) G_AddPlayerReport( ent, GS_MatchState() == MATCH_STATE_POSTMATCH ); for( team = TEAM_PLAYERS; team < GS_MAX_TEAMS; team++ ) G_Teams_UnInvitePlayer( team, ent ); if( !level.gametype.disableObituaries || !(ent->r.svflags & SVF_FAKECLIENT ) ) { if( !reason ) G_PrintMsg( NULL, "%s" S_COLOR_WHITE " disconnected\n", ent->r.client->netname ); else G_PrintMsg( NULL, "%s" S_COLOR_WHITE " disconnected (%s" S_COLOR_WHITE ")\n", ent->r.client->netname, reason ); } // send effect if( ent->s.team > TEAM_SPECTATOR ) G_TeleportEffect( ent, false ); ent->r.client->team = TEAM_SPECTATOR; G_ClientRespawn( ent, true ); // respawn as ghost ent->movetype = MOVETYPE_NOCLIP; // allow freefly // let the gametype scripts know this client just disconnected G_Gametype_ScoreEvent( ent->r.client, "disconnect", NULL ); G_FreeAI( ent ); AI_EnemyRemoved( ent ); ent->r.inuse = false; ent->r.svflags = SVF_NOCLIENT; memset( ent->r.client, 0, sizeof( *ent->r.client ) ); ent->r.client->ps.playerNum = PLAYERNUM( ent ); trap_ConfigString( CS_PLAYERINFOS+PLAYERNUM( ent ), "" ); GClip_UnlinkEntity( ent ); G_Match_CheckReadys(); }