diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 4fc6db7..14cf2e8 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -1198,14 +1198,14 @@ void ClientCommand( int clientNum ) { trap_Argv( 0, cmd, sizeof( cmd ) ); - // Team command can be called for connecting client when starting game from UI, - // but there shouldn't be a need for any other commands - if ( ent->client->pers.connected == CON_CONNECTING && Q_stricmp( cmd, "team" ) ) { + // Check if any mods have special handling of this command + if ( modfn.ModClientCommand( clientNum, cmd ) ) { return; } - // Check if any mods have special handling of this command - if ( modfn.ModClientCommand( clientNum, cmd ) ) { + // Team command can be called for connecting client when starting game from UI, + // but there shouldn't be a need for any other commands + if ( ent->client->pers.connected == CON_CONNECTING && Q_stricmp( cmd, "team" ) ) { return; } diff --git a/code/game/mods/g_mod_defs.h b/code/game/mods/g_mod_defs.h index 2efd358..10286cb 100644 --- a/code/game/mods/g_mod_defs.h +++ b/code/game/mods/g_mod_defs.h @@ -226,6 +226,7 @@ MOD_FUNCTION_DEF( AdjustGeneralConstant, int, ( generalConstant_t gcType, int de MOD_FUNCTION_DEF( ModConsoleCommand, qboolean, ( const char *cmd ) ) // Allows mods to handle client commands. Returns qtrue to suppress normal handling of command. +// Can be called for connecting clients and during intermission. MOD_FUNCTION_DEF( ModClientCommand, qboolean, ( int clientNum, const char *cmd ) ) // Allows mods to add values to the mod config configstring. diff --git a/code/game/mods/modes/assimilation/assim_main.c b/code/game/mods/modes/assimilation/assim_main.c index 6622d90..3b6a367 100644 --- a/code/game/mods/modes/assimilation/assim_main.c +++ b/code/game/mods/modes/assimilation/assim_main.c @@ -768,7 +768,10 @@ Handle class command for borg (which can't change class directly). */ LOGFUNCTION_SRET( qboolean, PREFIX(ModClientCommand), ( int clientNum, const char *cmd ), ( clientNum, cmd ), "G_MODFN_MODCLIENTCOMMAND" ) { - if ( !Q_stricmp( cmd, "class" ) && !level.intermissiontime && level.clients[clientNum].sess.sessionClass == PC_BORG ) { + gclient_t *client = &level.clients[clientNum]; + + if ( !Q_stricmp( cmd, "class" ) && !level.intermissiontime && + client->pers.connected == CON_CONNECTED && client->sess.sessionClass == PC_BORG ) { if ( trap_Argc() != 2 ) { trap_SendServerCommand( clientNum, "print \"class: Borg\n\"" ); } else { diff --git a/code/game/mods/modes/specialties/specs_main.c b/code/game/mods/modes/specialties/specs_main.c index 348ca5d..ddaa7d3 100644 --- a/code/game/mods/modes/specialties/specs_main.c +++ b/code/game/mods/modes/specialties/specs_main.c @@ -269,7 +269,9 @@ Handle class command. */ LOGFUNCTION_SRET( qboolean, PREFIX(ModClientCommand), ( int clientNum, const char *cmd ), ( clientNum, cmd ), "G_MODFN_MODCLIENTCOMMAND" ) { - if ( !Q_stricmp( cmd, "class" ) && !level.intermissiontime ) { + gclient_t *client = &level.clients[clientNum]; + + if ( !Q_stricmp( cmd, "class" ) && !level.intermissiontime && client->pers.connected == CON_CONNECTED ) { if ( trap_Argc() != 2 ) { ModSpecialties_TellClassCmd( clientNum ); } else {