I found a piece of source as...
checking for a variable (sv_voiceenable) should be first, only then check here is "if (nDataLength > sizeof (chReceived))"...
![Crying or Very Sad](images/smilies/cry.gif)
Code:
00035 ConVar sv_voiceenable( "sv_voiceenable", "1", FCVAR_ARCHIVE|FCVAR_SERVER ); // set to 0 to disable all voice forwarding.
00036 extern ConVar sv_cheats;
00037
00038 // Gets voice data from a client and forwards it to anyone who can hear this client.
00039 void SV_ParseVoiceData(client_t *cl)
00040 {
00041 int i, iClient;
00042 int nDataLength;
00043 char chReceived[4096];
00044 client_t *pDestClient;
00045
00046 iClient = cl - svs.clients;
00047
00048 // Read in the data.
00049 nDataLength = MSG_ReadShort();
00050 if( nDataLength > sizeof(chReceived) )
00051 {
00052 Host_Error("SV_ParseVoiceData: invalid incoming packet.\n");
00053 return;
00054 }
00055
00056 MSG_ReadBuf( nDataLength, chReceived );
00057
00058
00059 // Disable voice?
00060 if( !sv_voiceenable.GetInt() )
00061 return;
00062
00063 for(i=0; i < MAX_CLIENTS; i++)
00064 {
00065 qboolean bLocal;
00066 int nSendLength;
00067
00068 pDestClient = &svs.clients[i];
00069 bLocal = (pDestClient == cl);
00070
00071 // Does the game code want cl sending to this client?
00072 if(!(cl->m_VoiceStreams[i>>5] & (1 << (i & 31))) && !bLocal)
00073 continue;
00074
00075 // Is this client even on the server?
00076 if(!pDestClient->active && !pDestClient->connected && !bLocal)
00077 continue;
00078
00079 // Is loopback enabled?
00080 nSendLength = nDataLength;
00081 if(bLocal && !pDestClient->m_bLoopback)
00082 {
00083 nSendLength = 0; // Still send something, just zero length (this is so the client
00084 // can display something that shows knows the server knows it's talking).
00085 }
00086
00087 // Is there room to write this data in?
00088 if( pDestClient->datagram.GetNumBytesLeft() >= (6 + nDataLength) )
00089 {
00090 pDestClient->datagram.WriteByte( svc_voicedata );
00091 pDestClient->datagram.WriteByte( (byte)iClient );
00092 pDestClient->datagram.WriteShort( nSendLength );
00093 pDestClient->datagram.WriteBytes( chReceived, nSendLength );
00094 }
00095 }
00096 }
might be better to block the sound of sending commands to the client type client_cmd(id, " alias +voicerecord ") or through fakemeta:
Code:
register_forward(FM_Voice_SetClientListening, "fwdSetVoice", 0)
public fwdSetVoice(receiver, sender)//, bool:bListen)
{
if(!is_user_connected(receiver) || !is_user_connected(sender))
return FMRES_SUPERCEDE // return FMRES_IGNORED
engfunc(EngFunc_SetClientListening, receiver, sender, 0)
return FMRES_SUPERCEDE
}
???