diff options
Diffstat (limited to 'src/game/g_admin.c')
-rw-r--r-- | src/game/g_admin.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index e0b3be96..3bee21af 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -263,12 +263,32 @@ qboolean G_admin_name_check( gentity_t *ent, char *name, char *err, int len ) gclient_t *client; char testName[ MAX_NAME_LENGTH ] = {""}; char name2[ MAX_NAME_LENGTH ] = {""}; + int alphaCount = 0; G_SanitiseString( name, name2, sizeof( name2 ) ); if( !strcmp( name2, "unnamedplayer" ) ) return qtrue; + G_DecolorString( name, testName, sizeof( testName ) ); + if( isdigit( testName[ 0 ] ) ) + { + Q_strncpyz( err, "Names cannot begin with numbers", len ); + return qfalse; + } + + for( i = 0; testName[ i ]; i++) + { + if( isalpha( testName[ i ] ) ) + alphaCount++; + } + + if( alphaCount == 0 ) + { + Q_strncpyz( err, "Names must contain letters", len ); + return qfalse; + } + for( i = 0; i < level.maxclients; i++ ) { client = &level.clients[ i ]; |