diff options
Diffstat (limited to 'src/game/g_cmds.c')
-rw-r--r-- | src/game/g_cmds.c | 67 |
1 files changed, 58 insertions, 9 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index bcd51de..cd68354 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -994,31 +994,31 @@ void Cmd_Team_f( gentity_t *ent ) G_Say ================== */ -static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, const char *name, const char *message, const char *prefix ) +static qboolean G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, const char *name, const char *message, const char *prefix ) { qboolean ignore = qfalse; qboolean specAllChat = qfalse; if( !other ) - return; + return qfalse; if( !other->inuse ) - return; + return qfalse; if( !other->client ) - return; + return qfalse; if( other->client->pers.connected != CON_CONNECTED ) - return; + return qfalse; if( ( mode == SAY_TEAM || mode == SAY_ACTION_T ) && !OnSameTeam( ent, other ) ) { if( other->client->pers.teamSelection != PTE_NONE ) - return; + return qfalse; specAllChat = G_admin_permission( other, ADMF_SPEC_ALLCHAT ); if( !specAllChat ) - return; + return qfalse; // specs with ADMF_SPEC_ALLCHAT flag can see team chat } @@ -1026,11 +1026,11 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons if( mode == SAY_ADMINS && (!G_admin_permission( other, ADMF_ADMINCHAT) || other->client->pers.ignoreAdminWarnings || ( g_scrimMode.integer != 0 && !G_admin_permission( ent, ADMF_NOSCRIMRESTRICTION ) ) ) ) - return; + return qfalse; if( mode == SAY_HADMINS && (!G_admin_permission( other, ADMF_HIGHADMINCHAT) || other->client->pers.ignoreAdminWarnings ) ) - return; + return qfalse; if( BG_ClientListTest( &other->client->sess.ignoreList, ent-g_entities ) ) ignore = qtrue; @@ -1040,6 +1040,8 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons ( ignore ) ? "[skipnotify]" : "", ( specAllChat ) ? prefix : "", name, Q_COLOR_ESCAPE, color, message ) ); + + return qtrue; } #define EC "\x19" @@ -1203,6 +1205,13 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) for( j = 0; j < level.maxclients; j++ ) { other = &g_entities[ j ]; + if (other->client->pers.connected != CON_DISCONNECTED && other->client->pers.control != 0) + { + if (other->client->pers.control < 0) + continue; + if (G_SayTo(ent, &g_entities[other->client->pers.control - 1], mode, color, name, text, prefix)) + continue; + } G_SayTo( ent, other, mode, color, name, text, prefix ); } } @@ -1222,6 +1231,13 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) for( j = 0; j < level.maxclients; j++ ) { other = &g_entities[ j ]; + if (other->client->pers.connected != CON_DISCONNECTED && other->client->pers.control != 0) + { + if (other->client->pers.control < 0) + continue; + if (G_SayTo(ent, &g_entities[other->client->pers.control - 1], mode, color, name, text, prefix)) + continue; + } G_SayTo( ent, other, mode, color, name, text, prefix ); } } @@ -1279,11 +1295,22 @@ static void Cmd_SayArea_f( gentity_t *ent ) num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); for( i = 0; i < num; i++ ) + { + if (g_clients[entityList[i]].pers.connected != CON_DISCONNECTED && g_clients[entityList[i]].pers.control != 0) + { + if (g_clients[entityList[i]].pers.control < 0) + continue; + if (G_SayTo(ent, &g_entities[g_clients[entityList[i]].pers.control - 1], SAY_TEAM, color, name, msg, prefix)) + continue; + } G_SayTo( ent, &g_entities[ entityList[ i ] ], SAY_TEAM, color, name, msg, prefix ); + } //Send to ADMF_SPEC_ALLCHAT candidates for( i = 0; i < level.maxclients; i++ ) { + if (g_clients[i].pers.connected != CON_DISCONNECTED && g_clients[i].pers.control > 0) + continue; if( (&g_entities[ i ])->client->pers.teamSelection == PTE_NONE && G_admin_permission( &g_entities[ i ], ADMF_SPEC_ALLCHAT ) ) { @@ -2865,6 +2892,12 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) "called a team vote: %s^7 \n\"", ent->client->pers.netname, level.teamVoteDisplayString[ cs_offset ] ) ); trap_SendServerCommand( i, "cp \"A team vote has been called\n^2F1: Yes^7, ^1F2: No^7\"" ); } + else if (level.clients[i].pers.control > 0 + && (G_admin_permission(&g_entities[level.clients[i].pers.control - 1], ADMF_ADMINCHAT) + && (!Q_stricmp(arg1, "kick") || !Q_stricmp(arg1, "denybuild") + || level.clients[level.clients[i].pers.control - 1].pers.teamSelection == PTE_NONE))) + { + } else if( G_admin_permission( &g_entities[ i ], ADMF_ADMINCHAT ) && ( ( !Q_stricmp( arg1, "kick" ) || !Q_stricmp( arg1, "denybuild" ) ) || level.clients[ i ].pers.teamSelection == PTE_NONE ) ) @@ -3322,6 +3355,17 @@ void DBCommand( gentity_t *builder, pTeam_t team, const char *text ) if( !ent->client || ent->client->pers.connected != CON_CONNECTED ) continue; + if (ent->client->pers.control > 0) + { + gentity_t *e = &g_entities[ent->client->pers.control - 1]; + + if ((e->client->pers.teamSelection == team && e->client->pers.designatedBuilder) + || (e->client->pers.teamSelection == PTE_NONE && G_admin_permission(e, ADMF_SPEC_ALLCHAT))) + { + continue; + } + } + if( ( ent->client->pers.teamSelection == team && ent->client->pers.designatedBuilder ) || ( ent->client->pers.teamSelection == PTE_NONE && @@ -5454,6 +5498,11 @@ void ClientCommand( int clientNum ) int i; ent = g_entities + clientNum; + if (ent->client->pers.control > 0) + { + clientNum = ent->client->pers.control - 1; + ent = g_entities + clientNum; + } if( !ent->client ) return; // not fully in game yet |