Author Topic: Custom "E-Tard" Script help  (Read 1712 times)

What is the best way to emulate a flexible custom "E-Tard" script? I am working with one Psp created which right now only supports one word at a time.

Specifically, I am asking about an easier way to handle multiple word filters at once, as well as a case for detecting both Blockland and Update in one message.

Code: [Select]
// ============================================ ||
// ANTI-ANNOY BADSPOT SCRIPT                    ||
//                                              ||
// Script by Psp, modded slightly by Randomness ||
// ============================================ ||

package AntiAnnoy
{
    function serverCmdantiannoycheck(%client)
    {
     messageClient(%client,'',"\c6Yes, this server has the Anti Annoy script.");
    }
    function gameConnection::onClientEnterGame(%client)
{
parent::onClientEnterGame(%client);
                if(%client.name $= "Randomness") // Name changed so I can test it. What are the odds of Badspot joining anyway?
                {
                        $badspotishere = true;
                        parent::onClientEnterGame(%client);
                }
                else
                {
                     parent::onClientEnterGame(%client);
                }
}
function gameConnection::onClientLeaveGame(%client)
{
parent::onClientEnterGame(%client);
                if(%client.name $= "Randomness")
                {
                        $badspotishere = false;
                        parent::onClientLeaveGame(%client);
                }
                else
                {
                     parent::onClientLeaveGame(%client);
                }
}
        
        function serverCmdmessageSent(%client, %text)
{
       if($badspotishere)
       {
               //filter
                 for(%i=0;%i<64;%i++)
                 {
                       %word = getWord(%text, %i);
                       if(%word $= "Badspot")
                       {
                               messageClient(%client, '', "\c6Badspot wishes to not be distrubed.");
                                     return;
                       }
  else if(%word $= "Update")
  {
       messageClient(%client, '', "\c6Badspot wishes to not be distrubed.");
                                     return;
  }
                 }
       }
else
{
parent::serverCmdmessageSent(%client, %text); // this part looks suspicious
}
}
};

deactivatePackage(AntiAnnoy);
activatePackage(AntiAnnoy);

I think I messed up the parenting somewhere, but I'm unsure.

Never mind this double post: I think I found what I needed just as the topic was posted.

Badspot enters the game...
Person1: o hey
Person2: it's Badspot
Badspot doenst want to be disturbed
Person1: wow...

Literally the most useless snippet of code I've ever seen, besides maybe if(false) crash();

Not really, since its primary purpose is to lessen the noob crowd and speeches if Badspot actually does get onto a server. Thats the reason we all think he doesnt play anyway.

I got another problem:

Code: [Select]
    function serverCmdmessageSent(%client, %text)
{
        if($badspotishere)
        {
          if(findWordInString(%text,"Badspot"))
{
echo("Works");
}  
        }
parent::serverCmdmessageSent(%client, %text);
}

...which I believe to be the offender.

If a message is sent and does not have the offending words, it still denies the message to be sent anyways. I screwed something up and I dont know where.
« Last Edit: September 05, 2012, 12:12:36 AM by Randomness »

Not really, since its primary purpose is to lessen the noob crowd and speeches if Badspot actually does get onto a server.

"Hey baddy!"
"Hey, bad spot"
"hi bad"
"sup badspawt"
"yo baddibro"
"omg it's eric hartman"

"Hey baddy!"
"Hey, bad spot"
"hi bad"
"sup badspawt"
"yo baddibro"
"omg it's eric hartman"
Not really, since its primary purpose is to lessen the noob crowd and speeches if Badspot actually does get onto a server.

It will not lessen anything. They'll simply permutate the name to circumvent it.

I can simply circumvent "bad" and "eric hartman" and cover 98% of most permutations of the name.

"Hey baddy!"
"Hey, bad spot"
"hi bad"
"sup badspawt"
"yo baddibro"
"omg it's eric hartman"

I requested help: This doesn't look like helping out someone with coding problems. I have a purpose for this script is to get the message of not bothering Badspot to the noobs who -try- to bother him.

If you are not going to help or assist with coding problems, you don't need to be posting here.
« Last Edit: September 05, 2012, 03:05:34 AM by Randomness »

I can simply circumvent "bad" and "eric hartman" and cover 98% of most permutations of the name.
So what if the person legitimately has to say something is bad? "Wow, this build is really bad"

If you are not going to help or assist with coding problems, you don't need to be posting here.
You have no business telling me where I can and cannot post, if you want help you shouldn't be a total richardface to the people who actually provide help.

I was providing help. I was telling you that your method will not work in reality.

Regardless, I fixed it for you.
Code: [Select]
function serverCmdMessageSent(%client, %text)
{
if($badspotishere)
{
%pos = striPos(%text, "Badspot");
if(%pos >= 0)
{
messageClient(%client, '', "\c6Badspot wishes to not be disturbed.");
return;
}
}
parent::serverCmdMessageSent(%client,%text);
}

The reason it wouldn't send the messages is because you had it set up as

if($badspotIsHere) { checkcodehere(); } else { actuallySendMessage(); }

This resulted in messages never being sent while $badspotIsHere is set to a non false value.
« Last Edit: September 05, 2012, 03:16:29 AM by TripNick »

I think you should not have the parent in there. You must replace the default function in order for that to work.

I think you should not have the parent in there. You must replace the default function in order for that to work.
uhm no
he's parenting it because if it does see a nonfalse value for $badspotishere and it finds "Badspot" it will return nothing, exiting from the function. also, this is, on a basic level, replacing a default function...

"This is a bad way of making a script. You'll catch an unacceptable amount of server chat."
"Wow! That was a badass stunt you pulled there!"
"Your noob trap is badly designed. I escaped in five seconds."
"This server isn't as bad as I thought it would be..."
« Last Edit: September 07, 2012, 07:12:00 PM by Xalos »