Fixed teamswitching and team broadcasting

This commit is contained in:
Richard Allen 2002-02-26 04:59:10 +00:00
parent 0afa84eae1
commit cfbf5c6046

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.58 2002/02/26 04:59:10 jbravo
// Fixed teamswitching and team broadcasting
//
// Revision 1.57 2002/02/26 03:46:53 jbravo // Revision 1.57 2002/02/26 03:46:53 jbravo
// Range can now be set on grenades. // Range can now be set on grenades.
// //
@ -581,22 +584,24 @@ void BroadcastTeamChange( gclient_t *client, int oldTeam )
{ {
// JBravo: change team names if teamplay // JBravo: change team names if teamplay
if ( client->sess.sessionTeam == TEAM_RED ) {
if (g_gametype.integer == GT_TEAMPLAY) { if (g_gametype.integer == GT_TEAMPLAY) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined team 1.\n\"", if (client->sess.savedTeam == TEAM_RED) {
trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " joined team 1.\n\"",
client->pers.netname)); client->pers.netname));
} else if (client->sess.savedTeam == TEAM_BLUE) {
trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " joined team 2.\n\"",
client->pers.netname));
} else if (client->sess.savedTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR) {
trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " left his team.\n\"",
client->pers.netname));
}
} else { } else {
if ( client->sess.sessionTeam == TEAM_RED ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the red team.\n\"", trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the red team.\n\"",
client->pers.netname) ); client->pers.netname) );
}
} else if ( client->sess.sessionTeam == TEAM_BLUE ) { } else if ( client->sess.sessionTeam == TEAM_BLUE ) {
if ( g_gametype.integer == GT_TEAMPLAY ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined team 2.\n\"",
client->pers.netname));
} else {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the blue team.\n\"", trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the blue team.\n\"",
client->pers.netname)); client->pers.netname));
}
} else if ( client->sess.sessionTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR ) { } else if ( client->sess.sessionTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the spectators.\n\"", trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the spectators.\n\"",
client->pers.netname)); client->pers.netname));
@ -605,6 +610,7 @@ void BroadcastTeamChange( gclient_t *client, int oldTeam )
client->pers.netname)); client->pers.netname));
} }
} }
}
/* /*
================= =================
@ -736,9 +742,7 @@ void SetTeam( gentity_t *ent, char *s )
} }
// JBravo: lets set the correct var here. // JBravo: lets set the correct var here.
if ( g_gametype.integer != GT_TEAMPLAY ) { if (g_gametype.integer == GT_TEAMPLAY) {
client->sess.sessionTeam = team;
} else if ( !client->sess.teamSpawn ) {
client->sess.savedTeam = team; client->sess.savedTeam = team;
client->ps.persistant[PERS_SAVEDTEAM] = team; client->ps.persistant[PERS_SAVEDTEAM] = team;
} else { } else {
@ -785,9 +789,9 @@ void SetTeam( gentity_t *ent, char *s )
} }
// JBravo: to avoid messages when players are killed and move to spectator team. // JBravo: to avoid messages when players are killed and move to spectator team.
if ( client->sess.savedTeam != TEAM_RED && client->sess.savedTeam != TEAM_BLUE && g_gametype.integer != GT_TEAMPLAY ) { // if ( client->sess.savedTeam != TEAM_RED && client->sess.savedTeam != TEAM_BLUE && g_gametype.integer != GT_TEAMPLAY ) {
BroadcastTeamChange( client, oldTeam ); BroadcastTeamChange( client, oldTeam );
} // }
// get and distribute relevent paramters // get and distribute relevent paramters
@ -803,8 +807,6 @@ void SetTeam( gentity_t *ent, char *s )
ClientUserinfoChanged( clientNum ); ClientUserinfoChanged( clientNum );
ClientBegin( clientNum ); ClientBegin( clientNum );
} }
// ClientBegin( clientNum );
} }
/* /*