Ejemplo n.º 1
0
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;
		}
	}

}
Ejemplo n.º 2
0
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;

}