Results 1 to 3 of 3

Thread: Censor script?

  1. #1
    Private
    Join Date
    Nov 2014
    Posts
    25
    Thanks
    9
    Thanked 3 Times in 2 Posts

    Censor script?

    Was trying to make a script to censor swear words
    Here's my script:
    PHP Code:
    censor(string)
    {
        
    filehandle FS_FOpen("badwords.txt""read");
        while(
    badword != undefined)
        {
            
    badword FS_ReadLine(filehandle);
            
    msg StrRepl(stringbadword"******"));
        }
        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.

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Since you want to access/rewrite the chat messages, you gonna need libcod: http://killtube.org/showthread.php?1...Builtin-B3!%29

    And once you got that, I suggest using libcod file functions: http://killtube.org/showthread.php?1...-fwrite-fclose

    Then you just parse the badwords.txt file once and keep the array data in like level.badwords
    timescale 0.01

  3. #3
    Private
    Join Date
    Nov 2014
    Posts
    25
    Thanks
    9
    Thanked 3 Times in 2 Posts
    Quote Originally Posted by kung foo man View Post
    Since you want to access/rewrite the chat messages, you gonna need libcod: http://killtube.org/showthread.php?1...Builtin-B3!%29

    And once you got that, I suggest using libcod file functions: http://killtube.org/showthread.php?1...-fwrite-fclose

    Then you just parse the badwords.txt file once and keep the array data in like level.badwords
    Fixed.
    Thanks for the help
    Last edited by Kemi; 1st December 2015 at 23:05.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •