Well, I dont know if this helps, but I made this a long time ago: Customisable server side word filter.
I just changed in sv_user.c at the bottom this:
case clc_stringcmd:
s = MSG_ReadString(&net_message);
// malicious users may try using too many string commands
if (++stringCmdCount < MAX_STRINGCMDS)
SV_ExecuteUserCommand(s);
if (cl->state == cs_zombie)
return; // disconnect command
break;
With this:
case clc_stringcmd:
s = MSG_ReadString(&net_message);
// malicious users may try using too many string commands
if (++stringCmdCount < MAX_STRINGCMDS)
{
if(strstr(s, "say"))
{
char filter_filename[MAX_QPATH];
char *buf;
int file_len;
sprintf(filter_filename, "%s", Cvar_Get("filter_file", "configs/filter.txt", CVAR_ARCHIVE)->string);
file_len = FS_LoadFile(filter_filename, (void **)&buf);
//if (file_len < 0)
// return;
if (file_len != -1)
{
qboolean keeplooking = true;
char *token;
char *buf2;
// put null terminator at end:
buf2 = Z_Malloc(sizeof(char)*(file_len+1));
memcpy(buf2, buf, file_len);
buf2[file_len] = '\0';
FS_FreeFile(buf);
buf = buf2;
token = text_copy(COM_Parse(&buf));
while(*token)
{
if(keeplooking)
{
if(strstr(s, token))
{
strrep(s, &s, token, "*****");
keeplooking = false;
}
}
token = text_copy(COM_Parse(&buf));
}
}
}
SV_ExecuteUserCommand(s);
}
if (cl->state == cs_zombie)
return; // disconnect command
break;
It's probably not be the best way (and its probably buggy) since I made it a long time ago.
Edit: I just remembered strrep was a function I made but I cant remember where it is...