Blockland Forums > Modification Help

Chat filters

Pages: (1/4) > >>

computermix:

Alright, so I have been working on a project were when you say a word, it replaces that word with another character.

For example, the swear filter that is built in. If I said a "forbidden" word, it would be blocked with "*"s.

Heres a Small example on how it would "Catch" the word, but I need it to delete the entire message so it would be like the user never said it.

--- Code: ---package SwearFilter
{
function serverCmdmessagesent(%client, %text)
{
if(strstr(%text, "Theword") >= 0)
messageClient(%client, '', "\c6Do not say that.");

parent::servercmdMessagesent(%client, %text);
}
};
activatePackage(Swearfilter);
--- End code ---

Im sure this is possible. Can anyone help?

Kalphiter:

Calling the parent would send the message anyway

else
    parent::

computermix:


--- Quote from: Kalphiter on October 12, 2010, 05:25:52 PM ---Calling the parent would send the message anyway

else
    parent::

--- End quote ---

Im not completely into this "parent" stuff, can you give an example?

Kalphiter:


--- Code: ---package SwearFilter
{
function serverCmdmessagesent(%client, %text)
{
if(strstr(%text, "Theword") >= 0)
messageClient(%client, '', "\c6Do not say that.");

else
    parent::servercmdMessagesent(%client, %text);
}
};
activatePackage(Swearfilter);
--- End code ---


computermix:


--- Quote from: Kalphiter on October 12, 2010, 06:16:23 PM ---
--- Code: ---package SwearFilter
{
function serverCmdmessagesent(%client, %text)
{
if(strstr(%text, "Theword") >= 0)
messageClient(%client, '', "\c6Do not say that.");

else
    parent::servercmdMessagesent(%client, %text);
}
};
activatePackage(Swearfilter);
--- End code ---

--- End quote ---
Dam your fast. Let me see...

Pages: (1/4) > >>

Go to full version