int TeamFortress_TeamGetSecond( ) { int i, j, highest, highestteam, secondteam = 0, second = 0; highestteam = TeamFortress_TeamGetWinner( ); highest = TeamFortress_TeamGetScoreFrags( highestteam ); for ( i = 1; i < number_of_teams + 1; i++ ) { j = TeamFortress_TeamGetScoreFrags( i ); if ( j <= highest && ( j > second || secondteam == 0 ) && i != highestteam ) { second = j; secondteam = i; } } return secondteam; }
void RefreshStatusBar( gedict_t * pl ) { int win; int sec; gedict_t *te; const char *status_size,*status; char stmp[1024]; int clip; if ( !pl->StatusBarSize ) { pl->StatusRefreshTime = g_globalvars.time + 60; return; } pl->StatusRefreshTime = g_globalvars.time + 1.5; if ( !pl->playerclass ) return; status_size = GetStatusSize( pl ); status = default_status; if ( pl->playerclass == 9 || ( (pl->playerclass == 2 || pl->playerclass == 3 || pl->playerclass == 5 || pl->playerclass == 6 || pl->playerclass == 7 || tg_data.tg_sbar) && tfset(tg_enabled)) ) { /// eng sbar status = GetEngSbar( pl ); } else { if ( pl->playerclass == 8 ) status = GetSpySbar( pl ); if ( pl->playerclass == 4 ) { if ( pl->is_detpacking ) { status = " setting detpack "; } else { for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), "detpack" ));) { if ( te->s.v.owner != EDICT_TO_PROG( self ) ) continue; _snprintf( stmp, sizeof(stmp) , "Detpack: %d ", ( int ) ( te->s.v.nextthink - g_globalvars.time ) ); status = stmp; break; } } } if ( pl->playerclass == 1 ) { _snprintf( stmp, sizeof(stmp), "Scan %3d %s%s %3s ", pl->ScanRange, ( pl->tf_items_flags & 1 ) ? "En" : " ", ( pl->tf_items_flags & 2 ) ? "Fr" : " ", ( pl->ScannerOn ) ? "On " : "Off" ); status = stmp; } } win = TeamFortress_TeamGetWinner( ); sec = TeamFortress_TeamGetSecond( ); clip = GetClipSize( pl ); if( clip >= 0) G_centerprint( pl, "%s%s\n%s%3d %s%3d " _C _L _I _P ":%2d\n", status_size, status, teamnames[win], TeamFortress_TeamGetScore( win ), teamnames[sec], TeamFortress_TeamGetScore( sec ), clip); else G_centerprint( pl, "%s%s\n%s%3d %s%3d \n", status_size, status, teamnames[win], TeamFortress_TeamGetScore( win ), teamnames[sec], TeamFortress_TeamGetScore( sec )); }