/command chat replacer that replaces all "the"'s to "le"

Author Topic: /command chat replacer that replaces all "the"'s to "le"  (Read 1228 times)

https://forum.blockland.us/index.php?topic=315012.0 like this but instead of replacing all words it only replaces the



This code should do it

Code: [Select]
function serverCmdLe(%client, %n1, %n2, %n3, %n4, %n5, %n6) {
    if (!%client.isAdmin)
        return;
    %name = trim(%n1 SPC %n2 SPC %n3 SPC %n4 SPC %n5 SPC %n6);
    if (isObject(%target = findClientByName(%name)))
        %target.isLe = !%target.isLe;
}

package LePackage{
    function serverCmdMessageSent(%client, %text) {
        if (%client.isLe) {
            %wordCnt = getWordCount(%text);
            for (%i = 0; %i < %wordCnt; %i++) {
                %word = getWord(%text, %i);
                if (strLwr(%word) $= "the") {
                    // Account for different capitalization
                    // Probably a better way to handle this, but whatever
                    if (%word $= "the")
                        setWord(%text, %i, "le");
                    else if (%word $= "The")
                        setWord(%text, %i, "Le");
                    else if (%word $= "THE")
                        setWord(%text, %i, "LE");
                    else
                        setWord(%text, %i, "lE");
                }
            }
        }
        Parent::serverCmdMessageSent(%client, %text);
    }
};

activatePackage(LePackage);

I'll test it quick and package up an add-on for you.

Here you go. Code's a bit different than the example I posted. Use "/le <player name>" to toggle Le Chat mode. Only admins can use it.
« Last Edit: January 06, 2018, 04:02:03 AM by Platypi »

Here you go. Code's a bit different than the example I posted. Use "/le <player name>" to toggle Le Chat mode. Only admins can use it.
awesome lol

Here you go. Code's a bit different than the example I posted. Use "/le <player name>" to toggle Le Chat mode. Only admins can use it.
you have any idea how to get rid of the client message spam whenever someone says "the"

you have any idea how to get rid of the client message spam whenever someone says "the"
Oh stuff! I forgot to remove the debug code. One minute.

EDIT: This should do it.
« Last Edit: January 09, 2018, 09:28:23 PM by Platypi »

Oh stuff! I forgot to remove the debug code. One minute.

EDIT: This should do it.
tanks brudda