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,28 +584,31 @@ 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 ) { if (client->sess.savedTeam == TEAM_RED) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined team 1.\n\"", trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " joined team 1.\n\"",
client->pers.netname) ); client->pers.netname));
} else { } else if (client->sess.savedTeam == TEAM_BLUE) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the red team.\n\"", trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " joined team 2.\n\"",
client->pers.netname) ); client->pers.netname));
} } else if (client->sess.savedTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR) {
} else if ( client->sess.sessionTeam == TEAM_BLUE ) { trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " left his team.\n\"",
if ( g_gametype.integer == GT_TEAMPLAY ) { client->pers.netname));
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined team 2.\n\"", }
} else {
if ( client->sess.sessionTeam == TEAM_RED ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the red team.\n\"",
client->pers.netname) );
} else if ( client->sess.sessionTeam == TEAM_BLUE ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the blue team.\n\"",
client->pers.netname));
} else if ( client->sess.sessionTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the spectators.\n\"",
client->pers.netname));
} else if ( client->sess.sessionTeam == TEAM_FREE ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the battle.\n\"",
client->pers.netname)); client->pers.netname));
} else {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the blue team.\n\"",
client->pers.netname));
} }
} else if ( client->sess.sessionTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the spectators.\n\"",
client->pers.netname));
} else if ( client->sess.sessionTeam == TEAM_FREE ) {
trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the battle.\n\"",
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
@ -797,14 +801,12 @@ void SetTeam( gentity_t *ent, char *s )
CheckForUnevenTeams(ent); CheckForUnevenTeams(ent);
teamsave = client->sess.sessionTeam; teamsave = client->sess.sessionTeam;
client->sess.sessionTeam = client->sess.savedTeam; client->sess.sessionTeam = client->sess.savedTeam;
ClientUserinfoChanged( clientNum ); ClientUserinfoChanged(clientNum);
client->sess.sessionTeam = teamsave; client->sess.sessionTeam = teamsave;
} else { } else {
ClientUserinfoChanged( clientNum ); ClientUserinfoChanged( clientNum );
ClientBegin( clientNum ); ClientBegin( clientNum );
} }
// ClientBegin( clientNum );
} }
/* /*