mIRC Home    About    Download    Register    News    Help

Topic Options
#189403 - 07/11/07 10:10 AM Hi, i need some help with temp ban script
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
I find 1 script earlier has a virus in it. So i dare not try any unknown scripts again.

This is a channel protection script i found, I set it to max 3 chat per min, but after someone spam in the channel more 3 per min. This kick and ban that person.

What im finding is after someone talk more then 3 time per min in that channel, the bot temp ban that person for 5min for volating the rule.

Is it possible for me?
This is a copy of the script.

Any people here who has that script can share with me?

Code:
on 400:text:*flood*:#: {
  if ($1 == %c $+ global_flood) {
    if ($level($mask($address($nick,2),2)) < 500) { .msg $nick Only the bot owner can set this flag. | halt }
    if ($2 == $null) { .msg $nick Command incomplete. Syntax: %c $+ global_flood <on|off>. | halt }
    if ($2 !== $null) { 
      if ($2 == on) { writeini -n ini\globals.ini Protections Flood On | .msg $nick Global Flood Protection now set to ON. | .enable #flood | halt }
      if ($2 == off) { writeini -n ini\globals.ini Protections Flood Off | .msg  $nick Global Flood Protection now set to OFF. | .disable #flood | halt }
      else { .msg $nick Incorrect parameter. Available parameters: ON/OFF. | halt }
    }
  }
  if ($1 == %c $+ channel_flood) {
    if ($2 == $null) { .msg $nick Command incomplete. Syntax: %c $+ channel_flood <on|off>. | halt }
    if ($2 !== $null) {
      if (($readini(ini\globals.ini, Protections, Flood) == off) || ($readini(ini\globals.ini, Protections, Flood) == $null)) { .msg $nick Global Flood Protection not enabled. Contact the bot owner to enable it. | halt }
      if ($2 == on) { writeini -n ini\channels.ini $chan Flood On | .msg $nick Flood protection for $chan set to ON. | halt }
      if ($2 == off) { writeini -n ini\channels.ini $chan Flood Off | .msg $nick Flood protection for $chan set to OFF. | halt }
      else { .msg $nick Incorrect parameter. Available parameters: ON/OFF. | halt }
    }
  }
}
on 400:text:*flood*:?: {
  if ($1 == global_flood) {
    if ($level($mask($address($nick,2),2)) < 500) { .msg $nick Only the bot owner can set this flag. | halt }
    if ($2 == $null) { .msg $nick Command incomplete. Syntax: /msg $me global_flood <on|off>. | halt }
    if ($2 !== $null) { 
      if ($2 == on) { writeini -n ini\globals.ini Protections Flood On | .msg $nick Global Flood Protection now set to ON. | .enable #flood | halt }
      if ($2 == off) { writeini -n ini\globals.ini Protections Flood Off | .msg  $nick Global Flood Protection now set to OFF. | .disable #flood | halt }
      else { .msg $nick Incorrect parameter. Available parameters: ON/OFF. | halt }
    }
  }
  if ($1 == channel_flood) {
    if ($2 == $null) { .msg $nick Command incomplete. Syntax: /msg $me channel_flood <#channel> <on|off>. | halt }
    if ($2 !== $null) && ($3 !== $null) {
      if (($readini(ini\globals.ini, Protections, Flood) == off) || ($readini(ini\globals.ini, Protections, Flood) == $null)) { .msg $nick Global Flood Protection not enabled. Contact the bot owner to enable it. | halt }
      if ($3 == on) { writeini -n ini\channels.ini $2 Flood On | .msg $nick Flood protection for $2 set to ON. | halt }
      if ($3 == off) { writeini -n ini\channels.ini $2 Flood Off | .msg $nick Flood protection for $2 set to OFF. | halt }
      else { .msg $nick Incorrect parameter. Available parameters: ON/OFF. | halt }
    }
  }
}
#flood on
on @+1!:text:*:#: {
  if ($nick isop $chan) { halt }
  inc %flood.nick [ $+ [ $nick ] $+ [ $chan ] ]
  .timer 1 %flood.channel.time /unset %flood.nick [ $+ [ $nick ] $+ [ $chan ] ]
  if (%flood.nick [ $+ [ $nick ] $+ [ $chan ] ] > %flood.channel.lines) { 
    if (($readini(ini\globals.ini, Protections, Flood) == on) && ($readini(ini\channels.ini, $chan, Flood) == on)) { $iif(%kb.method != 2, mode $chan +btn $mask($address($nick,2),2)) | kick $chan $nick $cl Flood | unset %flood.nick [ $+ [ $nick ] ] | halt }
  }
  else { halt }
}
on @+1!:action:*:#: {
  if ($nick isop $chan) { halt }
  inc %flood.nick [ $+ [ $nick ]  $+ [ $chan ]
  .timer 1 %flood.channel.time /unset %flood.nick [ $+ [ $nick ] $+ [ $chan ]
  if (%flood.nick [ $+ [ $nick ] $+ [ $chan ] > %flood.channel.lines) { 
    if (($readini(ini\globals.ini, Protections, Flood) == on) && ($readini(ini\channels.ini, $chan, Flood) == on)) { $iif(%kb.method != 2, mode $chan +btn $mask($address($nick,2),2)) |  kick $chan $nick $cl Flood | unset %flood.nick [ $+ [ $nick ] ] | halt  }
  }
  else { halt }
}
#flood end
on @1:deop:#: {
  if ($nick == $me) { halt }
  if ($level($mask($address($opnick,2),2)) > $level($mask($address($nick,2),2))) { mode $chan -o+o $nick $opnick | .msg $nick Illegal deop. }
}
;@@@ Self protections @@@
on +1!:Text:*:?: {
  if ($readini(ini\globals.ini, Protections, SFlood) == On) {
    inc %flood.nick [ $+ [ $nick ]
    .timer 1 %flood.self.time /unset %flood.nick [ $+ [ $nick ]
    if (%flood.nick [ $+ [ $nick ]  > %flood.self.num) { 
      .ignore -pnitkdu $+ %flood.self.ignore $nick 2
    }
  }
}
on +1!:notice:*:?: {
  if ($readini(ini\globals.ini, Protections, SNotice) == On) {
    inc %flood.nickN [ $+ [ $nick ]
    .timer 1 %notice.self.time /unset %flood.nickN [ $+ [ $nick ]
    if (%flood.nickN [ $+ [ $nick ]  > %notice.self.num) { 
      .ignore -pnitkdu $+ %notice.self.ignore $nick 2
    }
  }
}
ctcp +1!:*:?: {
  if ($readini(ini\globals.ini, Protections, SCtcp) == On) {
    inc %flood.nickC [ $+ [ $nick ]
    .timer 1 %CTCP.self.time /unset %flood.nickC [ $+ [ $nick ]
    if (%flood.nickC [ $+ [ $nick ]  > %CTCP.self.num) { 
      .ignore -pnitkdu $+ %CTCP.self.ignore $nick 2
    }
  }
}
on +1!:invite:*: {
  if ($readini(ini\globals.ini, Protections, SInvite) == On) {
    inc %flood.nickI [ $+ [ $nick ]
    .timer 1 %invite.self.time /unset %flood.nickI [ $+ [ $nick ]
    if (%flood.nickI [ $+ [ $nick ]  > %invite.self.num) { 
      .ignore -pnitkdu $+ %invite.self.ignore $nick 2
    }
  }
}

Top
#189419 - 07/11/07 03:00 PM Re: Hi, i need some help with temp ban script [Re: Flexible]
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
Is there no one could help me ?

Top
#189447 - 07/11/07 08:34 PM Re: Hi, i need some help with temp ban script [Re: Flexible]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
you looking for a script that kick on repeats ?
Code:
on @*:text:*:#: {
  if ( %rep_tid == $null ) { set %rep_tid 60 }
  if ( %rep_ban == $null ) { set %rep_ban 120 }
  if ( %rep_antal == $null ) { set %rep_antal 3 }
  if ($nick == null) { return }
  var %rp.repeats = rp. $+ $nick $+ . $+ $chan
  var %rp.text = rp. $+ $nick $+ . $+ $chan $+ .text
  if ( % [ $+ [ %rp.repeats ] ] == $null ) {
    set -u [ $+ [ %rep_tid ] ] % [ $+ [ %rp.repeats ] ] 1
    set -u [ $+ [ %rep_tid ] ] % [ $+ [ %rp.text ] ] $1-
  }
  elseif ( % [ $+ [ %rp.text ] ] == $1- ) {
    inc % [ $+ [ %rp.repeats ] ]
  }
  elseif ( % [ $+ [ %rp.text ] ] != $1- ) {
    set -u [ $+ [ %rep_tid ] ] % [ $+ [ %rp.text ] ] $1-
    set -u [ $+ [ %rep_tid ] ] % [ $+ [ %rp.repeats ] ] 1
  }
  if ( % [ $+ [ %rp.repeats ] ] >= %rep_antal ) {
    kick # $nick % [ $+ [ %rp.repeats ] ] repeats in %rep_tid second(s) Banned for $calc(%rep_ban / 60)) $+ minute(s)
    ban -u $+ %rep_ban # $nick %bs
    unset %rp. $+ $nick $+ . $+ $chan
    unset %rp. $+ $nick $+ . $+ $chan $+ . $+ text
  }
}


set %rep_tid xx <- repeat rate. default is set to 1 minute

set %rep_ban xx <- set how long the script should ban the user. default 2 minutes.

set %rep_antal xx <- set how many repeats a user is allowed to do.

everything is calced in seconds, so you need to use the value 60 for 1 minute .. 120 for two minutes and so on. And the script will ban for repeats, if you dont want that, coment out the line:

ban -u $+ %rep_ban # $nick 3

just add a ; infront of it and ur done, but then you maybe want to change the kick message.

and the code goes in to a clean remote file, ALT + R in your mirc, then create a new file and paste the code in to it.

If you want to be able to enable/disable it, then use a group for it:

#repeatkick on
code here
#repeatkick end

enable it with /enable #repeatkick
or disable it with: /disable #repeatkick


Edited by sparta (07/11/07 08:45 PM)
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#189477 - 08/11/07 02:22 AM Re: Hi, i need some help with temp ban script [Re: sparta]
foshizzle Offline
Fjord artisan

Registered: 20/08/07
Posts: 333
Loc: Silicon Valley
regex works well smile (you can make it like 1-3 lines long)
_________________________
This is not the signature you are looking for

Top
#189489 - 08/11/07 08:58 AM Re: Hi, i need some help with temp ban script [Re: foshizzle]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
Originally Posted By: foshizzle
regex works well smile (you can make it like 1-3 lines long)


why dont you make one to him then? smile
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#190824 - 27/11/07 06:39 AM Re: Hi, i need some help with temp ban script [Re: sparta]
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
Hi this works well, but can i activate this script only in a specific channel?


Edited by Flexible (27/11/07 07:36 AM)

Top
#190828 - 27/11/07 08:44 AM Re: Hi, i need some help with temp ban script [Re: Flexible]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
Replace the part: on @*:text:*:#: { with this one: on @*:text:*:#your_channel_here: {
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#190829 - 27/11/07 09:05 AM Re: Hi, i need some help with temp ban script [Re: sparta]
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
Hey, thanks it work now. i can activate it in a channel i want.

Hi, after i changed the default ban time and max spam to 6spam/1min, it still do not work.
[Look at the bolded words]
Quote:
on @*:text:*:#: {
if ( %rep_tid == $null ) { set %rep_tid 60 }
if ( %rep_ban == $null ) { set %rep_ban 60 }
if ( %rep_antal == $null ) { set %rep_antal 6 }
if ($nick == null) { return }
var %rp.repeats = rp. $+ $nick $+ . $+ $chan
var %rp.text = rp. $+ $nick $+ . $+ $chan $+ .text
if ( % [ $+ [ %rp.repeats ] ] == $null ) {
set -u [ $+ [ %rep_tid ] ] % [ $+ [ %rp.repeats ] ] 1
set -u [ $+ [ %rep_tid ] ] % [ $+ [ %rp.text ] ] $1-
}
elseif ( % [ $+ [ %rp.text ] ] == $1- ) {
inc % [ $+ [ %rp.repeats ] ]
}
elseif ( % [ $+ [ %rp.text ] ] != $1- ) {
set -u [ $+ [ %rep_tid ] ] % [ $+ [ %rp.text ] ] $1-
set -u [ $+ [ %rep_tid ] ] % [ $+ [ %rp.repeats ] ] 1
}
if ( % [ $+ [ %rp.repeats ] ] >= %rep_antal ) {
.msg # 15,1[9,1 $nick 15]15,01[08 has been muted for 1Min for breaking the 5Spams/Min rule 15]
ban -u $+ %rep_ban # $nick %bs
unset %rp. $+ $nick $+ . $+ $chan
unset %rp. $+ $nick $+ . $+ $chan $+ . $+ text
}
}


Edited by Flexible (27/11/07 09:06 AM)

Top
#190830 - 27/11/07 09:23 AM Re: Hi, i need some help with temp ban script [Re: Flexible]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
if ( %rep_tid == $null ) { set %rep_tid 60 }
if ( %rep_ban == $null ) { set %rep_ban 60 }
if ( %rep_antal == $null ) { set %rep_antal 6 }

that part will only be set if it dosent have any settings since befor. so if u want to set it that way, then unset them first..
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#190831 - 27/11/07 09:24 AM Re: Hi, i need some help with temp ban script [Re: sparta]
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
Erm, how to unset?

Top
#190832 - 27/11/07 09:33 AM Re: Hi, i need some help with temp ban script [Re: Flexible]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
This goes in to your remote, edit the text how you want it, just made something fast.
Code:
menu @channel {
 Repeat Kick
 .During time:{ set %rep_tid $?="Enter time (in secs)" }
 .Amount:{ set %rep_antal $?="How many?" }
 .Ban time:{ set %rep_antal $?="Enter time (in secs)" }
 .-
 .Current:{ echo -a During time is set to: %rep_tid $+ . Amount is set to: %rep_antal $+ . And ban time is set to: %rep_antal $+ . }
 .Unset:{ unset %rep_* }
}
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#190833 - 27/11/07 09:38 AM Re: Hi, i need some help with temp ban script [Re: sparta]
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
hmm, actually i figured out, no need to unset actaully.
I should nt edit at the remote but at the Variables.
Now its done.

png

Top
#190834 - 27/11/07 09:40 AM Re: Hi, i need some help with temp ban script [Re: Flexible]
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
i have 1 more question.
Can i change this repeat spam script to a Word ban script?
Such as banning the person if he repeats a specific word then i set.

Such as if i set AssHole as the specific word.
And,

Code:
<Person>ASSHOLE!!!
<Person>ASSHOLE!!!
<Person>ASSHOLE!!!
<Bot>[ Person ][ has been muted for 2Min for swearing repeatly ]


Edited by Flexible (27/11/07 09:41 AM)

Top
#190869 - 28/11/07 03:21 AM Re: Hi, i need some help with temp ban script [Re: Flexible]
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
hmm how can i make this script to be protecting OPs and voice.
So that OPs or voice wont get kb

Top
#190873 - 28/11/07 04:28 AM Re: Hi, i need some help with temp ban script [Re: Flexible]
nomer2007 Offline
Babel fish

Registered: 18/10/07
Posts: 92
Code:
if ($nick !isop $chan) && ($nick != isvo $chan) {

Top
#190875 - 28/11/07 06:53 AM Re: Hi, i need some help with temp ban script [Re: nomer2007]
Bekar Offline
Fjord artisan

Registered: 11/12/02
Posts: 503
Loc: Melbourne, Australia
I think you're wanting !isvo, not != isvo

Top
#190877 - 28/11/07 09:22 AM Re: Hi, i need some help with temp ban script [Re: Flexible]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
if (ASSHOLE isin $1-) {

or you can read it from a file:

if ( $read -l $+ $1- $qt($mircdir\textfile.txt) == $null ) { return }

something like that, untested tho.
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#190902 - 28/11/07 02:53 PM Re: Hi, i need some help with temp ban script [Re: nomer2007]
Horstl Offline
Hoopy frood

Registered: 03/11/06
Posts: 1559
Loc: Germany
Originally Posted By: nomer2007
Code:
if ($nick !isop $chan) && ($nick != isvo $chan) {
Besides the small typo, the most clear sollution to exclude ALL ops and voices (what about %halfops, &protecteds etc (if the ircd allows these modes)) would be imho: make the script evaluate the other way around: make it trigger only for regular users (that is: users without ANY mode prefix/channel privilegues)

stop processing for non-regular users:
if ($nick !isreg $chan) { return }

or proceed if it's a regular user:
if ($nick isreg $chan) { protection stuff }

smile

Top
#190998 - 30/11/07 08:30 AM Re: Hi, i need some help with temp ban script [Re: Flexible]
Flexible Offline
Pikka bird

Registered: 07/11/07
Posts: 10
Code:
on @*:text:*:#: {
  if ( %rep_tid1 == $null ) { set %rep_tid1 $60 }
  if ( %rep_ban1 == $null ) { set %rep_ban1 $300 }
  if ( %rep_antal1 == $null ) { set %rep_antal1 $4 }
  if ($nick isop $chan) { halt }  
  if ($nick isvoice $chan) { halt }
  if ($nick == null) { return }

  var %rp.repeats = rp. $+ $nick $+ . $+ $chan
  var %rp.text = rp. $+ $nick $+ . $+ $chan $+ .text
  if ( % [ $+ [ %rp.repeats ] ] == $null ) { 
    set -u [ $+ [ %rep_tid1 ] ] % [ $+ [ %rp.repeats ] ] 1
    set -u [ $+ [ %rep_tid1 ] ] % [ $+ [ %rp.text ] ] $1- 
  }
  elseif ( % [ $+ [ %rp.text ] ] == $1- ) {
    inc % [ $+ [ %rp.repeats ] ]
    inc -u10 $+(%,sw,$nick) 1
  }
  elseif ( % [ $+ [ %rp.text ] ] != $1- ) {
    set -u [ $+ [ %rep_tid1 ] ] % [ $+ [ %rp.text ] ] $1-
    set -u [ $+ [ %rep_tid1 ] ] % [ $+ [ %rp.repeats ] ] 1
  }
  if ( % [ $+ [ %rp.repeats ] ] >= %rep_antal1 ) {
    .msg # 15,1[9,1 $nick 15]15,01[08 has been muted for 5Min for breaking the 3Spams/Min rule 15]
    ban -u $+ %rep_ban1 # $nick %bs
    unset %rp. $+ $nick $+ . $+ $chan
    unset %rp. $+ $nick $+ . $+ $chan $+ . $+ text
  }
}

From this script. How do i add the Word ban in like Spartar gave.

Top