mIRC Home    About    Download    Register    News    Help

Print Thread
#109680 31/01/05 06:19 PM
Joined: Jan 2005
Posts: 10
R
ryanc Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
I would like to add a simple script that will kick and ban (with a reason) a memebr for 60 min everytime they say a word in swear.txt

Can someone show me how to do this? I am a noob just started MIRC 5 days ago! blush

Thanks, confused


Ryan wink

Joined: Mar 2004
Posts: 175
Vogon poet
Offline
Vogon poet
Joined: Mar 2004
Posts: 175
This goes into your remotes section of your scripts editor:

Code:
On @*:TEXT:*:#: {
  var %a = 1
  While ($($+($,%a),2)) {
    If ($Read(swear.txt,r,$v1)) {
      ban -ku3600 # $Nick Swearing. 1 hour ban.
      break
    }
    inc %a
  }
}
On @*:ACTION:*:#: {
  var %a = 1
  While ($($+($,%a),2)) {
    If ($Read(swear.txt,r,$v1)) {
      ban -ku3600 # $Nick Swearing. 1 hour ban.
      break
    }
    inc %a
  }
}
On @*:NOTICE:*:#: {
  var %a = 1
  While ($($+($,%a),2)) {
    If ($Read(swear.txt,r,$v1)) {
      ban -ku3600 # $Nick Swearing. 1 hour ban.
      break
    }
    inc %a
  }
}


- Relinsquish
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
nice clean script, just thought i might say it would be less code , and more debugable / additionable if it was done with an alias as so.

Code:
On @*:TEXT:*:#:check.for.ban $1-
On @*:ACTION:*:#:check.for.ban $1-
On @*:NOTICE:*:#:check.for.ban $1-
alias -l check.for.ban {
  tokenize 32 $replace($strip($1-),$chr(160),$chr(32))
  var %a = 1
  While ($($+($,%a),2)) {
    If ($Read(swear.txt,r,$v1)) {
      ban -ku3600 # $Nick Swearing. 1 hour ban.
      break
    }
    inc %a
  }
}


Also i added a ctrl code stripper and a hardspace to space translation, both in the tokenize, its ammazing what people well do to get around a bad word ban, ie badword becomes bad<ctrl-b>ctrl-b>word or badword<asc160> etc

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
While we are at it, it could be a good idea to add an != $null check in the while condition, so that the loop doesn't stop when one of the tokens is a 0, $false or $null. Ok, it might still go wrong if a person says $null in a string, though the odds of that happening are a lot slimmer.

If we really want to nitpick (and some of us do this way too much), we could just check for the existence of the token, rather than check for the value of the token.

Something like:

while $0 {
do things
tokenize 32 $2-
}

People who ask for help here on the boards are amongst the luckiest, since scripters nitpick so much, just to give the "best" help. This isn't aimed at you Dave, just replying to you as you are the last poster in the thread :tongue:

Greets


Gone.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
While we are at it, it could be a good idea to add an != $null check in the while condition, so that the loop doesn't stop when one of the tokens is a 0. Ok, it might still go wrong if a person says $false or $null in a string, though the odds of that happening are a lot slimmer.


Oh Damn i just broke one of my scripts using "balh blah blah $null what about this text then?"

Quote:
while $0 {
do things
tokenize 32 $2-
}


I love using tokenize 32 $2-,
I think it helps make the code more usable, since any alterations/additions dont need some complexe refrencing to what your processing this time through, no $eval($ $+ %i,2) <is that even right?> or $gettok($1-,%i,32), just a plain simple $1


Quote:
People who ask for help here on the boards are amongst the luckiest, since scripters nitpick so much, just to give the "best" help. This isn't aimed at you Dave, just replying to you as you are the last poster in the thread :tongue:


No probs, as I said above, I nneded that notice myself, sicne i didnt think of someone deliberitly putting a text in to confuse the script langauge.

I took the nicks [ ] { | } on my favorite net since i new they can play screwy with some scripts.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hehe,

yeah $eval($ $+ %i,2) is correct.

It's funny sometimes in rooms, they'll have a swear kicker testing with while ($gettok($1-,%i,32)) and you can just get away with swearing by putting a 0, $null, or $false as the first token, haha.

Cya


Gone.

Link Copied to Clipboard