Author Topic: Mod won't execute  (Read 2730 times)

So I'm making a mod called Nocuss and it is where if someone swears or whatever you want to call it, they get kicked. Tell me if there are any problems and why it won't execute. Here it is. Please don't say anything negative about it.
« Last Edit: September 05, 2012, 03:48:00 PM by padmedog »

This goes in Coding Help i believe but heck.

That mod is kind of mean. Considering 89% of Blocklanders swear

This goes in Coding Help i believe but heck.

That mod is kind of mean. Considering 89% of Blocklanders swear
Agh, forgot to update with "don't say anything negative about my mod".

Do what Brian said below me.
« Last Edit: September 06, 2012, 09:57:54 AM by Electrk »

Nocuss mod?
That sounds a bit...
harsh.

or kiddish go back to your MLP.

whichever you please.

Agh, forgot to update with "don't say anything negative about my mod".
You don't make the rules.

I actually misread title as "Mold won't excute" and was expecting a spam topic.

I actually misread title as "Mold won't excute" and was expecting a spam topic.
What

This is a horrible way to deal with swears
try
Code: [Select]
$Str::replaceWord["ass"] = "apple";
$Str::replaceWord["bitch"] = "bananna";
$Str::replaceWord["cunt"] = "coconut";
$Str::replaceWord["forget"] = "fruit";
$Str::replaceWord["monday"] = "nannyberry";
$Str::replaceWord["brother"] = "nannyberreh";
$Str::replaceWord["niga"] = "nanyberreh";
$Str::replaceWords = "ass bitch cunt forget monday brother niga";
//Niger is a country, face it.
package noCuss
{
function serverCmdMessageSent(%client,%msg)
{
%cnt = getWordCount($Str::replaceWords);
for(%i=0;%i<%cnt;%i++)
%msg = strReplace(%msg,getWord($Str::replaceWords,%i),$Str::replaceWord[getWord($Str::replaceWords,%i)]);
return parent::serverCmdMessageSent(%client,%msg);
}
};activatepackage(noCuss);
it replaces swears with fruits.

This is a horrible way to deal with swears
try
Code: [Select]
$Str::replaceWord["ass"] = "apple";
$Str::replaceWord["bitch"] = "bananna";
$Str::replaceWord["cunt"] = "coconut";
$Str::replaceWord["forget"] = "fruit";
$Str::replaceWord["monday"] = "nannyberry";
$Str::replaceWord["brother"] = "nannyberreh";
$Str::replaceWord["niga"] = "nanyberreh";
$Str::replaceWords = "ass bitch cunt forget monday brother niga";
//Niger is a country, face it.
package noCuss
{
function serverCmdMessageSent(%client,%msg)
{
%cnt = getWordCount($Str::replaceWords);
for(%i=0;%i<%cnt;%i++)
%msg = strReplace(%msg,getWord($Str::replaceWords,%i),$Str::replaceWord[getWord($Str::replaceWords,%i)]);
return parent::serverCmdMessageSent(%client,%msg);
}
};activatepackage(noCuss);
it replaces swears with fruits.
Brian wins again.

First off, in server.cs it should be exec("./main.cs"); instead of exec("main.cs");
Or he could just skip that pointless step and put the code in server.cs
(Still don't understand why people do that)


What's wrong with the default filter?

Or he could just skip that pointless step and put the code in server.cs
(Still don't understand why people do that)


What's wrong with the default filter?

Also this.
I don't understand it unless you want organization. There's still no point in having the server.cs only execute other files.

First off, in server.cs it should be exec("./main.cs"); instead of exec("main.cs");
I fixed it just now.

Secondly,

Code: [Select]
function serverCmdMessageSent(%client, %forget)
{
findclientbyname(%client).delete("No cursing");
}

function serverCmdMessageSent(%client, %stuff)
{
findclientbyname(%client).delete("No cursing");
}

function serverCmdMessageSent(%client, %ass)
{
findclientbyname(%client).delete("No cursing");
}

function serverCmdMessageSent(%client, %starfish)
{
findclientbyname(%client).delete("No cursing");
}

...what

You keep overwriting serverCmdMessageSent

You use the words you want to censor as args for the function?

You delete the player's client when they swear Point of the mod. Still stupid though
I might change this

You didn't parent the function, so no one will be able to talk. You parented autoAdminCheck correctly which makes me think you probably copypasted from someone else's code.
True



I think this is the right way:

Code: [Select]
function serverCmdMessageSent(%c,%msg) {

parent::serverCmdMessageSent(%c,%msg);

if(striPos(%msg,"forget") != -1) {
findClientByName(%c.name).delete("Please don't swear");
return;

}

}
Would just doing
function serverCmdMessageSent(%c,%msg) {

   parent::serverCmdMessageSent(%c,%msg);

   if(striPos(%msg,"forget") != -1) {
      findClientByName(%c.name).delete("Please don't swear");
      return;   

   }

}
function serverCmdMessageSent(%c,%msg) {

   parent::serverCmdMessageSent(%c,%msg);

   if(striPos(%msg,"forget") != -1) {
      findClientByName(%c.name).delete("Please don't swear");
      return;   

   }

}
function serverCmdMessageSent(%c,%msg) {

   parent::serverCmdMessageSent(%c,%msg);

   if(striPos(%msg,"forget") != -1) {
      findClientByName(%c.name).delete("Please don't swear");
      return;   

   }

}
Over and over work?


You'll have to package it though
To be honest, this might make me dumb, but what does package mean for coding?

Honestly, I would use what brain said.

I would just edit the Medieval Chat add-on and remove anything that isn't a curse word/swear/derogatory term/slur and make the replacement some symbols. It already has 86 of those words. That way the message is sent but the vulgarity censored. A message box that pops up and prevents you from sending the message would be really annoying.