Kemi
30th November 2015, 15:55
Was trying to make a script to censor swear words
Here's my script:
censor(string)
{
filehandle = FS_FOpen("badwords.txt", "read");
while(badword != undefined)
{
badword = FS_ReadLine(filehandle);
msg = StrRepl(string, badword, "******"));
}
return msg;
}
Trying to make it that only admins with ranks of 40+ can swear, anyone else it will be censored.
This is just as a test, not something I actually plan to implement into the server.
Just wanted to know if it's bad to use the FS_ReadLine command in a loop such as that and if there would be any problems if I did without a large wait.
Here's my script:
censor(string)
{
filehandle = FS_FOpen("badwords.txt", "read");
while(badword != undefined)
{
badword = FS_ReadLine(filehandle);
msg = StrRepl(string, badword, "******"));
}
return msg;
}
Trying to make it that only admins with ranks of 40+ can swear, anyone else it will be censored.
This is just as a test, not something I actually plan to implement into the server.
Just wanted to know if it's bad to use the FS_ReadLine command in a loop such as that and if there would be any problems if I did without a large wait.