Check out build #324

Free SVN / GIT Hosting. Unlimited users, repos and 1GB space. Bug and issue tracking tools.


assembla
Chat Censor For Jolt

  • using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using RuneScape.GameServer.Model.Characters.Script;
    using RuneScape.GameServer.Model;
    using RuneScape.GameServer.Model.Characters;
    using RuneScape.GameServer;

    namespace Content.Misc
    {


    /**
    * @author awesomist
    **/
    public class ChatCensor
    {
    ///
    /// Happens when script instance is initialized.
    ///

    private static string[] profanityWords = { "fuck", "cock", "asshole", "ass hole", "nigger", "bitch", "cunt", "pussy", "dumbass", "dickhead", "dick", "biatch", "fatass" };

    private static string[] censoredWords = { ".com", ".org", ".net", ".biz", ".info" };

    public static string checkMessage(Character Character, string message)
    {
    for (int i = 0; i < profanityWords.Length; i++)
    {
    if (message.Contains(profanityWords[i]))
    {
    message = message.Replace(profanityWords[i], getStars(profanityWords[i].Length));
    }
    }
    for (int i = 0; i < censoredWords.Length; i++)
    {
    if (message.Contains(censoredWords[i]))
    {
    message = message.Replace(censoredWords[i], getStars(censoredWords[i].Length));
    }
    }
    return message;
    }

    private static string getStars(int number)
    {
    string stars = "";
    for (int i = 0; i < number; i++)
    {
    stars += "*";
    }
    return stars;


    }
    }
    }


    It doesn't work...
  • Any errors?
  • Any errors?

    No. It just doesnt work.
  • If you assume that the chat censor will work by just adding this into scripts, you're wrong. To be precise, you can't do this because the packet that handles chat messages in directly handled in the core, and doesn't require any scripting to be done.

    We have a prototype censor, and we'll implement this soon. This isn't really priority to us, because neither me nor anyone else is going to use it for their servers. 
  • Ah well. Everything I develop is unneeded or useless.
    Thanks for the info.
  • Not really Awesomist... pack up your nice script and put it on hot-script.com and then people could use it for filtering messages, for say, from site's like facebook's chat. Just don't think facebook would do that.
  • If you want to make a script that would kick/ban someone you could write one that reads the chat log every time something is said from runescapedb-chat_logs. That might work, but i'd ask first.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook

In this Discussion

Tagged