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.
// ============================================ ||
// 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.