Blockland Forums > Modification Help
Chat filters
Bauklotz:
If you want it to be case-sensitive, use
--- Code: ---if(strPos(%msg,"theWoRD") >= 0)
--- End code ---
If you want it to be case-insensitive, use
--- Code: ---if(striPos(%msg,"theword") >= 0)
--- End code ---
also, nonrelated topic title much? (Chat effects).
--- Quote from: Xalos on October 12, 2010, 10:21:39 PM ---closes.
--- End quote ---
or does
--- Code: ---deleteVariables("$PATTERN");
--- End code ---
computermix:
--- Quote from: Bauklotz on October 13, 2010, 07:12:26 AM ---If you want it to be case-sensitive, use
--- Code: ---if(strPos(%msg,"theWoRD") >= 0)
--- End code ---
If you want it to be case-insensitive, use
--- Code: ---if(striPos(%msg,"theword") >= 0)
--- End code ---
also, nonrelated topic title much? (Chat effects).
or does
--- Code: ---deleteVariables("$PATTERN");
--- End code ---
--- End quote ---
I don't exactly want to write the words a million times, for example, If I made a swear filter...
--- Code: ---package SwearFilter
{
function serverCmdmessagesent(%client, %text)
{
if(strstr(%text, "ass") >= 0) //"Section 1: Asses"
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "Ass") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "ASs") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "ASS") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "AsS") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "aSs") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "asS") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "aSS") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "A$s") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "As$") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "A$$") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "A$s") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "A$S") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "AS$") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "a$s") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "as$") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "a$$") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "A$s") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "a$s") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "a$S") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "a$s") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "@$$") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "@$s") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "@$S") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "@S$") >=0)
messageClient(%client, '', "\c6Do not say that.");
else if(strstr(%text, "@s$") >=0)
messageClient(%client, '', "\c6Do not say that.");//This burns my fingers.
else
parent::servercmdMessagesent(%client, %text);
}
};
activatePackage(Swearfilter);
--- End code ---
Then I have to do the other words, too. That would take forever!
Bauklotz:
Then use case-isensitivity, or use variables and a file reader that reads a file for words.
computermix:
--- Quote from: Bauklotz on October 13, 2010, 01:51:40 PM ---Then use case-isensitivity, or use variables and a file reader that reads a file for words.
--- End quote ---
It Semi-worked, as in I tried
--- Code: ---"if(strpos(%text, "ass") >=0)"
--- End code ---
and "ass" was blocked, but then I tried "ASS" and it failed. I think I have an idea.
Truce:
--- Quote from: computermix on October 13, 2010, 03:00:29 PM --- It Semi-worked, as in I tried
--- Code: ---"if(strpos(%text, "ass") >=0)"
--- End code ---
and "ass" was blocked, but then I tried "ASS" and it failed. I think I have an idea.
--- End quote ---
You need to use striPos, not strPos.