Skip to content

Commit

Permalink
Moving client model checking into BugFixes branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
LevShisterov committed Jun 20, 2012
1 parent 5a1636a commit 8a5ee27
Showing 1 changed file with 6 additions and 34 deletions.
40 changes: 6 additions & 34 deletions dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,6 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
if ( !pEntity->pvPrivateData )
return;

char text[256];
CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)&pEntity->v);
if (!pPlayer->IsConnected())
return;

// msg everyone if someone changes their name, and it isn't the first time (changing no name to current name)
if ( pEntity->v.netname && STRING(pEntity->v.netname)[0] != 0 && !FStrEq( STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" )) )
{
Expand All @@ -503,8 +498,12 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
// Set the name
g_engfuncs.pfnSetClientKeyValue( ENTINDEX(pEntity), infobuffer, "name", sName );

char text[256];
sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
UTIL_SayTextAll(text, pPlayer);
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
MESSAGE_END();

// team match?
if ( g_teamplay )
Expand All @@ -527,34 +526,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
}
}

// Check for incorrect player model
char *mdls = g_engfuncs.pfnInfoKeyValue( infobuffer, "model" );
if (_stricmp(mdls, pPlayer->m_szTeamName)) // Yes m_szTeamName will be always "" in non-teamplay, so we will do some extra unneeded checks to model, but it is not hard.
{
char model[256];
strncpy(model, mdls, sizeof(model) - 1);
model[sizeof(model) - 1] = '\0';
char *p = model;
while (*p != NULL)
{
if (*p < 32 ||
*p == '<' || *p == '>' || *p == ':' || *p == ';' ||
*p == '%' || *p == '?' || *p == '*' || *p == '"' ||
*p == '|' || *p == '/' || *p == '\\')
*p = ' ';
p++;
}
if (_stricmp(mdls, model))
{
int clientIndex = pPlayer->entindex();
g_engfuncs.pfnSetClientKeyValue(clientIndex, g_engfuncs.pfnGetInfoKeyBuffer(pPlayer->edict()), "model", model);
g_engfuncs.pfnSetClientKeyValue(clientIndex, g_engfuncs.pfnGetInfoKeyBuffer(pPlayer->edict()), "team", model);
sprintf(text, "* Model can't contain special characters like: <>:;%%?*\"|/\\\n" );
UTIL_SayText(text, pPlayer);
}
}

g_pGameRules->ClientUserInfoChanged(pPlayer, infobuffer);
g_pGameRules->ClientUserInfoChanged( GetClassPtr((CBasePlayer *)&pEntity->v), infobuffer );
}

static int g_serveractive = 0;
Expand Down

0 comments on commit 8a5ee27

Please sign in to comment.