const char *TeamFortress_TeamGetColorString( int tno ) { int col; col = TeamFortress_TeamGetColor( tno ); if ( col > 14 ) col = 0; return colornames[col]; }
//========================================================================= // Make the spy who owns this timer undercover, and then remove itself void TeamFortress_SpyUndercoverThink( ) { gedict_t *owner = PROG_TO_EDICT( self->s.v.owner ); if ( owner->playerclass != PC_SPY ) return; if ( owner->is_undercover == 2 ) { if ( tf_data.invis_only == 1 ) { owner->s.v.items = ( int ) owner->s.v.items | IT_INVISIBILITY; owner->s.v.frame = 0; owner->s.v.modelindex = modelindex_eyes; owner->is_undercover = 1; } else { owner->immune_to_check = g_globalvars.time + tf_data.cheat_pause; //10; if ( self->s.v.skin ) { owner->undercover_skin = self->s.v.skin; TeamFortress_SetSkin( owner ); G_sprint( owner, 2, "Skin set to " ); TeamFortress_PrintClassName( owner, self->s.v.skin, 0 ); } if ( self->s.v.team ) { owner->undercover_team = self->s.v.team; TeamFortress_SetColor( owner, TeamFortress_TeamGetTopColor( self->s.v.team ), TeamFortress_TeamGetColor( self->s.v.team ) - 1 ); TeamFortress_SetSkin( owner ); G_sprint( owner, 2, "Colors set to Team %.0f\n", self->s.v.team ); } TeamFortress_SpyCalcName( owner ); if ( !owner->StatusBarSize ) G_centerprint( owner, "You are now disguised.\n" ); owner->is_undercover = 1; } } owner->StatusRefreshTime = g_globalvars.time + 0.1; dremove( self ); }
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 ) ); } }*/ }
void TeamFortress_CheckTeamCheats( ) { char st[20]; const char *sk; int tc; if ( self->immune_to_check > g_globalvars.time ) return; if ( self->s.v.deadflag ) return; if ( !( self->s.v.netname[0] ) ) KickCheater( self ); else { if ( self->playerclass && !self->team_no && teamplay > 0 ) KickCheater( self ); } if ( self->team_no > 0 && teamplay > 0 ) { tc = GetInfokeyInt( self, "bottomcolor", NULL, 0 ); if ( self->playerclass == PC_SPY && self->undercover_team ) { if ( TeamFortress_TeamGetColor( self->undercover_team ) - 1 != tc ) { TeamFortress_SetColor( self, TeamFortress_TeamGetTopColor( self->undercover_team ), TeamFortress_TeamGetColor( self->undercover_team ) - 1 ); G_bprint( 1, "%s has been kicked for changing color.\n", self->s.v.netname ); G_sprint( self, 2, "You have been kicked for changing your pants color. Don't do it.\n" ); KickCheater( self ); return; } } else { if ( tc != TeamFortress_TeamGetColor( self->team_no ) - 1 ) { TeamFortress_SetColor( self, TeamFortress_TeamGetTopColor( self->team_no ), TeamFortress_TeamGetColor( self->team_no ) - 1 ); G_bprint( 1, "%s has been kicked for changing color.\n", self->s.v.netname ); G_sprint( self, 2, "You have been kicked for changing your pants color. Don't do it.\n" ); KickCheater( self ); return; } } if ( tf_data.topcolor_check ) { tc = GetInfokeyInt( self, "topcolor", NULL, 0 ); if ( self->playerclass == PC_SPY && self->undercover_team ) { if ( TeamFortress_TeamGetTopColor( self->undercover_team ) != tc ) { TeamFortress_SetColor( self, TeamFortress_TeamGetTopColor( self->undercover_team ), TeamFortress_TeamGetColor( self->undercover_team ) - 1 ); G_bprint( 1, "%s has been kicked for changing color.\n", self->s.v.netname ); G_sprint( self, 2, "You have been kicked for changing your top color. Don't do it.\n" ); KickCheater( self ); return; } } else { if ( tc != TeamFortress_TeamGetTopColor( self->team_no ) ) { TeamFortress_SetColor( self, TeamFortress_TeamGetTopColor( self->undercover_team ), TeamFortress_TeamGetColor( self->undercover_team ) - 1 ); G_bprint( 1, "%s has been kicked for changing color.\n", self->s.v.netname ); G_sprint( self, 2, "You have been kicked for changing your top color. Don't do it.\n" ); KickCheater( self ); return; } } } if ( self->playerclass ) { GetInfokeyString( self, "skin", NULL, st, sizeof( st ), "" ); tc = 0; sk = TeamFortress_GetSkin( self ); if ( strneq( st, sk ) ) { TeamFortress_SetSkin( self ); G_bprint( 1, "%s has been kicked for changing skin.\n", self->s.v.netname ); G_sprint( self, 2, "You have been kicked for changing your skin. Don't do it.\n" ); KickCheater( self ); } if ( tc == 8 ) self->playerclass = 8; } sk = GetTeamName( self->team_no ); GetInfokeyString( self, "team", NULL, st, sizeof( st ), "" ); if ( strneq( st, sk ) ) { SetTeamName( self ); G_bprint( 1, " has been kicked for changing team.\n", self->s.v.netname ); G_sprint( self, 2, "You have been kicked for changing your team. Don't do it.\n" ); KickCheater( self ); return; } } }
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; }
qboolean ClientUserInfoChanged( ) { char key[1024]; char value[1024]; const char *sk; int color; self = PROG_TO_EDICT( g_globalvars.self ); trap_CmdArgv( 1, key, sizeof( key ) ); trap_CmdArgv( 2, value, sizeof( value ) ); if ( !strcmp( key, "team" ) ) { if ( !self->team_no ) return 0; sk = GetTeamName( self->team_no ); if ( strneq( value, sk ) ) { SetTeamName( self ); G_sprint( self, 2, "you cannot change your team setinfo\n" ); return 1; } return 0; } if ( !strcmp( key, "skin" ) ) { if ( !self->playerclass || !self->team_no ) return 0; sk = TeamFortress_GetSkin( self ); if ( strneq( value, sk ) ) { G_sprint( self, 2, "you cannot change your skin setinfo\n" ); TeamFortress_SetSkin( self ); return 1; } return 0; } if ( ( !strcmp( key, "topcolor" ) ) && tf_data.topcolor_check ) { if ( !self->team_no ) return 0; color = atoi( value ); if ( self->playerclass == PC_SPY && self->undercover_team ) { if ( TeamFortress_TeamGetTopColor( self->undercover_team ) != color ) { G_sprint( self, 2, "you cannot change your topcolor setinfo\n" ); return 1; } } else { if ( TeamFortress_TeamGetTopColor( self->team_no ) != color ) { G_sprint( self, 2, "you cannot change your topcolor setinfo\n" ); return 1; } } return 0; } if ( ( !strcmp( key, "bottomcolor" ) ) ) { if ( !self->team_no ) return 0; color = atoi( value ); if ( self->playerclass == PC_SPY && self->undercover_team ) { if ( TeamFortress_TeamGetColor( self->undercover_team ) - 1 != color ) { G_sprint( self, 2, "you cannot change your bottomcolor setinfo\n" ); return 1; } } else { if ( TeamFortress_TeamGetColor( self->team_no ) - 1 != color ) { G_sprint( self, 2, "you cannot change your bottomcolor setinfo\n" ); return 1; } } return 0; } SetClientSetting( self, Q_strlwr( key ), value); return 0; }