void TeamFortress_TeamIncreaseScore( int tno, int scoretoadd ) { gedict_t *e; if ( !tno || !scoretoadd || tno > 4 ) return; teamscores[tno] += scoretoadd; if ( ( tf_data.toggleflags & TFLAG_TEAMFRAGS ) || ( tf_data.toggleflags & TFLAG_FULLTEAMSCORE ) ) { for ( e = world; ( e = trap_find( e, FOFS( s.v.classname ), "player" ) ) ; ) { if ( e->team_no == tno ) e->s.v.frags = TeamFortress_TeamGetScore( tno ); } } UpdateServerinfoScores(); }
void TeamFortress_TeamShowScores( int all ) { const char *st; int i; int j; int fl2; int fl3; int fix1; int fix2; int totalf; i = 1; fl2 = 0; fl3 = 0; if ((all == 2)) { while ((i <= number_of_teams)) { if ((TeamFortress_TeamGetColor (i) > 0)) { j = TeamFortress_TeamGetScore (i); st = TeamFortress_TeamGetColorString (i); G_bprint (2, st); G_bprint (2, ": "); //st = ftos (j); G_bprint (2, "%d",j); G_bprint (2, " "); if ((j >= TeamFortress_TeamGetScore (fl2))) { fl3 = fl2; fl2 = i; } else { if ((j >= TeamFortress_TeamGetScore (fl3))) { fl3 = i; } } } i = i + 1; } G_bprint (2, "\n"); sound (world, 4, "misc/update.wav", 1, 0); /* if ((quadscore > 0)) { if ((team1score > team2score)) { bprint (2, ""); bprint (2, TeamFortress_TeamGetColorString (1)); bprint (2, " θασ χοξ τθε νατγθ‘\n"); execute_changelevel (); return; } }*/ // Changed code slightly.. if ((TeamFortress_TeamGetScore (fl2) != TeamFortress_TeamGetScore (fl3))) { //char totals; fix1 = ((TeamFortress_TeamGetScore (fl2))); fix2 = ((TeamFortress_TeamGetScore (fl3))); totalf = (fix1 - fix2); //totals = ftos (totalf); if (totalf != 0) { G_bprint (2, ""); G_bprint (2, TeamFortress_TeamGetColorString (fl2)); G_bprint (2, " ισ μεαδιξη βω "); G_bprint (2, "%d",totalf); // bprint (2, ftos ((TeamFortress_TeamGetScore (fl2) - TeamFortress_TeamGetScore (fl3)))); G_bprint (2, "\n"); } else { G_bprint (2, "Τθε ηανε ισ tied\n"); } } else { G_bprint (2, "Τθε ηανε ισ tied\n"); } return; } while ((i <= number_of_teams)) { if ((TeamFortress_TeamGetColor (i) > 0)) { if (all) { G_bprint (2, "Team "); } else { G_sprint (self, 2, "Team "); } //st = ftos (i); if (all) { G_bprint (2, "%d", i); } else { G_sprint (self, 2, "%d", i); } if (all) { G_bprint (2, " ("); } else { G_sprint (self, 2, " ("); } st = TeamFortress_TeamGetColorString (i); if (all) { G_bprint (2, "%c",st); } else { G_sprint (self, 2, "%c", st); } if (all) { G_bprint (2, ") : "); } else { G_sprint (self, 2, ") : "); } j = TeamFortress_TeamGetScore (i); //st = ftos (j); if (all) { G_bprint (2, "%d", j); } else { G_sprint (self, 2, "%d", j); } if (all) { G_bprint (2, "\n"); } else { G_sprint (self, 2, "\n"); } } i = i + 1; } /* // orig score code int i; if ( all == 2 ) { for ( i = 1; i <= number_of_teams; i++ ) { if ( TeamFortress_TeamGetColor( i ) > 0 ) { G_bprint( 2, "%s: %d ", TeamFortress_TeamGetColorString( i ), TeamFortress_TeamGetScore( i ) ); } } G_bprint( 2, "\n" ); return; } for ( i = 1; i <= number_of_teams; i++ ) { if ( TeamFortress_TeamGetColor( i ) > 0 ) { if ( all ) G_bprint( 2, "Team %d (%s) : %d\n", i, TeamFortress_TeamGetColorString( i ), TeamFortress_TeamGetScore( i ) ); else G_sprint( self, 2, "Team %d (%s) : %d\n", i, TeamFortress_TeamGetColorString( i ), TeamFortress_TeamGetScore( i ) ); } }*/ }
int TeamFortress_TeamSet( int tno ) { int tc; if ( teamplay < 1 ) { G_sprint( self, 2, "Teamplay is not On, so FortressTeams are inactive.\n" ); return 0; } if ( tno > number_of_teams && number_of_teams ) { G_sprint( self, 2, "There can be only %d teams on this map.\nTry again\n", number_of_teams ); return 0; } if ( self->team_no > 0 ) { G_sprint( self, 2, "You're already in Team No %d.\n", self->team_no ); return 0; } tc = TeamFortress_TeamGetNoPlayers( tno ); if ( tc >= TeamFortress_TeamGetMaxPlayers( tno ) ) { G_sprint( self, 2, "That team is full. Pick another.\n" ); return 0; } if ( !TeamFortress_TeamGetColor( tno ) ) { //TeamFortress_TeamSetColor( tno ); if ( !TeamFortress_TeamGetColor( tno ) ) { G_sprint( self, 2, "You can't start a new team with your color, since another " ); G_sprint( self, 2, "already using that color. Change your pants color, then try again.\n" ); return 0; } G_bprint( 2, "%s has started Team No %d.\n", self->s.v.netname, tno ); self->immune_to_check = g_globalvars.time + 10; if ( ( tf_data.toggleflags & TFLAG_TEAMFRAGS ) || ( tf_data.toggleflags & TFLAG_FULLTEAMSCORE ) ) self->s.v.frags = TeamFortress_TeamGetScore( tno ); TeamFortress_SetColor( self, TeamFortress_TeamGetTopColor( tno ), TeamFortress_TeamGetColor( tno ) - 1 ); self->team_no = tno; self->lives = TeamFortress_TeamGetLives( tno ); SetTeamName( self ); if ( !self->playerclass ) { if ( TeamFortress_TeamIsCivilian( self->team_no ) ) { self->s.v.impulse = 1; TeamFortress_ChangeClass( ); } } return 1; } G_bprint( 2, "%s has joined Team No %d.\n", self->s.v.netname, tno ); TeamFortress_SetColor( self, TeamFortress_TeamGetTopColor( tno ), TeamFortress_TeamGetColor( tno ) - 1 ); self->team_no = tno; self->immune_to_check = g_globalvars.time + 10; self->lives = TeamFortress_TeamGetLives( tno ); if ( ( tf_data.toggleflags & TFLAG_TEAMFRAGS ) || ( tf_data.toggleflags & TFLAG_FULLTEAMSCORE ) ) self->s.v.frags = TeamFortress_TeamGetScore( tno ); TeamFortress_TeamShowMemberClasses( self ); SetTeamName( self ); if ( !self->playerclass ) { if ( TeamFortress_TeamIsCivilian( self->team_no ) ) { self->s.v.impulse = 1; TeamFortress_ChangeClass( ); } } return 1; }
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 )); }