diff options
-rw-r--r-- | src/game/g_admin.c | 9 | ||||
-rw-r--r-- | src/game/g_client.c | 12 | ||||
-rw-r--r-- | src/game/g_cmds.c | 10 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_main.c | 4 | ||||
-rw-r--r-- | src/game/g_team.c | 2 |
6 files changed, 21 insertions, 18 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 530a1dd8..634d2054 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -2615,8 +2615,11 @@ qboolean G_admin_rename( gentity_t *ent ) ADMP( va( "^3rename: ^7%s\n", err ) ); return qfalse; } - victim->client->pers.namelog->nameChanges--; - victim->client->pers.namelog->nameChangeTime = 0; + if( victim->client->pers.connected != CON_CONNECTED ) + { + ADMP( "^3rename: ^7sorry, but your intended victim is still connecting\n" ); + return qfalse; + } trap_GetUserinfo( pids[ 0 ], userinfo, sizeof( userinfo ) ); AP( va( "print \"^3rename: ^7%s^7 has been renamed to %s^7 by %s\n\"", victim->client->pers.netname, @@ -2624,7 +2627,7 @@ qboolean G_admin_rename( gentity_t *ent ) ( ent ) ? ent->client->pers.netname : "console" ) ); Info_SetValueForKey( userinfo, "name", newname ); trap_SetUserinfo( pids[ 0 ], userinfo ); - ClientUserinfoChanged( pids[ 0 ] ); + ClientUserinfoChanged( pids[ 0 ], qtrue ); return qtrue; } diff --git a/src/game/g_client.c b/src/game/g_client.c index b241c110..c3afede2 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -971,7 +971,7 @@ The game can override any of the settings and call trap_SetUserinfo if desired. ============ */ -char *ClientUserinfoChanged( int clientNum ) +char *ClientUserinfoChanged( int clientNum, qboolean forceName ) { gentity_t *ent; char *s; @@ -1016,7 +1016,7 @@ char *ClientUserinfoChanged( int clientNum ) if( strcmp( oldname, newname ) ) { - if( client->pers.namelog->nameChangeTime && + if( !forceName && client->pers.namelog->nameChangeTime && level.time - client->pers.namelog->nameChangeTime <= g_minNameChangePeriod.value * 1000 ) { @@ -1025,7 +1025,7 @@ char *ClientUserinfoChanged( int clientNum ) g_minNameChangePeriod.integer ) ); revertName = qtrue; } - else if( g_maxNameChanges.integer > 0 && + else if( !forceName && g_maxNameChanges.integer > 0 && client->pers.namelog->nameChanges >= g_maxNameChanges.integer ) { trap_SendServerCommand( ent - g_entities, va( @@ -1033,7 +1033,7 @@ char *ClientUserinfoChanged( int clientNum ) g_maxNameChanges.integer ) ); revertName = qtrue; } - else if( client->pers.namelog->muted ) + else if( !forceName && client->pers.namelog->muted ) { trap_SendServerCommand( ent - g_entities, "print \"You cannot change your name while you are muted\n\"" ); @@ -1056,7 +1056,7 @@ char *ClientUserinfoChanged( int clientNum ) { Q_strncpyz( client->pers.netname, newname, sizeof( client->pers.netname ) ); - if( client->pers.connected == CON_CONNECTED ) + if( !forceName && client->pers.connected == CON_CONNECTED ) { client->pers.namelog->nameChangeTime = level.time; client->pers.namelog->nameChanges++; @@ -1265,7 +1265,7 @@ char *ClientConnect( int clientNum, qboolean firstTime ) // get and distribute relevent paramters G_namelog_connect( client ); - userInfoError = ClientUserinfoChanged( clientNum ); + userInfoError = ClientUserinfoChanged( clientNum, qfalse ); if( userInfoError != NULL ) return userInfoError; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index c9cb889c..2a3edfd9 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1564,7 +1564,7 @@ void Cmd_Class_f( gentity_t *ent ) //remove credit G_AddCreditToClient( ent->client, -cost, qtrue ); ent->client->pers.classSelection = newClass; - ClientUserinfoChanged( clientNum ); + ClientUserinfoChanged( clientNum, qfalse ); VectorCopy( infestOrigin, ent->s.pos.trBase ); VectorCopy( ent->client->ps.velocity, oldVel ); @@ -1989,7 +1989,7 @@ void Cmd_Buy_f( gentity_t *ent ) G_TriggerMenu( ent->client->ps.clientNum, MN_H_UNKNOWNITEM ); //update ClientInfo - ClientUserinfoChanged( ent->client->ps.clientNum ); + ClientUserinfoChanged( ent->client->ps.clientNum, qfalse ); } @@ -2161,7 +2161,7 @@ void Cmd_Sell_f( gentity_t *ent ) G_TriggerMenu( ent->client->ps.clientNum, MN_H_UNKNOWNITEM ); //update ClientInfo - ClientUserinfoChanged( ent->client->ps.clientNum ); + ClientUserinfoChanged( ent->client->ps.clientNum, qfalse ); } @@ -2625,7 +2625,7 @@ static void Cmd_Ignore_f( gentity_t *ent ) if( !Com_ClientListContains( &ent->client->sess.ignoreList, pids[ i ] ) ) { Com_ClientListAdd( &ent->client->sess.ignoreList, pids[ i ] ); - ClientUserinfoChanged( ent->client->ps.clientNum ); + ClientUserinfoChanged( ent->client->ps.clientNum, qfalse ); trap_SendServerCommand( ent-g_entities, va( "print \"[skipnotify]" "ignore: added %s^7 to your ignore list\n\"", level.clients[ pids[ i ] ].pers.netname ) ); @@ -2642,7 +2642,7 @@ static void Cmd_Ignore_f( gentity_t *ent ) if( Com_ClientListContains( &ent->client->sess.ignoreList, pids[ i ] ) ) { Com_ClientListRemove( &ent->client->sess.ignoreList, pids[ i ] ); - ClientUserinfoChanged( ent->client->ps.clientNum ); + ClientUserinfoChanged( ent->client->ps.clientNum, qfalse ); trap_SendServerCommand( ent-g_entities, va( "print \"[skipnotify]" "unignore: removed %s^7 from your ignore list\n\"", level.clients[ pids[ i ] ].pers.netname ) ); diff --git a/src/game/g_local.h b/src/game/g_local.h index 81e3105f..a6fff69b 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -994,7 +994,7 @@ int G_TimeTilSuddenDeath( void ); // g_client.c // char *ClientConnect( int clientNum, qboolean firstTime ); -char *ClientUserinfoChanged( int clientNum ); +char *ClientUserinfoChanged( int clientNum, qboolean forceName ); void ClientDisconnect( int clientNum ); void ClientBegin( int clientNum ); void ClientCommand( int clientNum ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 2f708235..cefcd76d 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -298,7 +298,7 @@ Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, i return 0; case GAME_CLIENT_USERINFO_CHANGED: - ClientUserinfoChanged( arg0 ); + ClientUserinfoChanged( arg0, qfalse ); return 0; case GAME_CLIENT_DISCONNECT: @@ -1004,7 +1004,7 @@ void G_SpawnClients( team_t team ) ent = &g_entities[ clientNum ]; ent->client->sess.spectatorState = SPECTATOR_NOT; - ClientUserinfoChanged( clientNum ); + ClientUserinfoChanged( clientNum, qfalse ); ClientSpawn( ent, spawn, spawn_origin, spawn_angles ); } } diff --git a/src/game/g_team.c b/src/game/g_team.c index b0709949..2cd03737 100644 --- a/src/game/g_team.c +++ b/src/game/g_team.c @@ -240,7 +240,7 @@ void G_ChangeTeam( gentity_t *ent, team_t newTeam ) // Copy credits to ps for the client ent->client->ps.persistant[ PERS_CREDIT ] = ent->client->pers.credit; - ClientUserinfoChanged( ent->client->ps.clientNum ); + ClientUserinfoChanged( ent->client->ps.clientNum, qfalse ); G_UpdateTeamConfigStrings( ); |