diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 29a1ce1d..df74ef06 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -592,8 +592,8 @@ void SetTeam( gentity_t *ent, char *s ) { // execute the team change // - // if the player was dead leave the body - if ( client->ps.stats[STAT_HEALTH] <= 0 ) { + // if the player was dead leave the body, but only if they're actually in game + if ( client->ps.stats[STAT_HEALTH] <= 0 && client->pers.connected == CON_CONNECTED ) { CopyToBodyQue(ent); } @@ -633,6 +633,11 @@ void SetTeam( gentity_t *ent, char *s ) { // get and distribute relevent paramters ClientUserinfoChanged( clientNum ); + // client hasn't spawned yet, they sent an early team command + if ( client->pers.connected != CON_CONNECTED ) { + return; + } + ClientBegin( clientNum ); } @@ -1659,6 +1664,14 @@ void ClientCommand( int clientNum ) { ent = g_entities + clientNum; if (!ent->client || ent->client->pers.connected != CON_CONNECTED) { + if (ent->client && ent->client->pers.localClient) { + // Handle early team command sent by UI when starting a local + // team play game. + trap_Argv( 0, cmd, sizeof( cmd ) ); + if (Q_stricmp (cmd, "team") == 0) { + Cmd_Team_f (ent); + } + } return; // not fully in game yet }