mIRC Homepage
Posted By: x3pos spam protection help - 13/02/17 03:10 PM
Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return } 
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3- 
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
  if ($nick isop $chan) { return }
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) { 
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }

  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}


This works but it does not work when the moderator writes.

Code:
viewer:1
viewer:2
viewer:3
bot:viewer you are spamming to fast. timeout!

this is working good
Code:
viewer:1
viewer:2
moderatör:hi
viewer:hello
bot:viewer you are spamming to fast. timeout!

this is wrong because writing 1 time.
code is ignoring moderators.
Posted By: Blas Re: spam protection help - 13/02/17 06:26 PM
I think you're wanting the "%spamlines" and "%spamnick" to restart to 0 when a mod says a message in channel. I would get rid of the "if ($nick isop $chan) { return }" line and add a check to see if the user who typed the message is a mod before adding their name to the %spamnick and adding to the %spamlines. If they are a mod, then erase/unset the %spamlines and %spamnick.

Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3-
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) {
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }
  }
  elseif ($nick isop $chan) {
    unset %spamnick
    unset %spamlines
  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}
Posted By: x3pos Re: spam protection help - 14/02/17 06:01 PM
Sorry did not work this code.
Posted By: Blas Re: spam protection help - 15/02/17 08:32 PM
I'm not sure what you were asking then. smirk
Posted By: x3pos Re: spam protection help - 16/02/17 05:57 PM
No you understand what I ask but the code did not work
Posted By: Fonic_Artes Re: spam protection help - 16/02/17 11:33 PM
Lemme see if I can understand.

Do you want it to time out moderators for spamming, or just regular viewers?
Posted By: x3pos Re: spam protection help - 17/02/17 02:51 AM
This code works exactly as I want it to, but the problem is this.
Let's say I made the bottom line writing limit 3.(!timeout line 3)
No problem running command good.
But when the moderators write the text between the bottom line and the bottom line, the code does not see what I wrote and the viewer is timeout. I want the code to be edited. When moderators write, I want the counter to be zero.
example,
Code:
viewer1=1
viewer1=2
viewer1=3
bot=viewer1 timeout! you are spamming!

Code:
viewer1=1
viewer1=2
moderator1=hello
moderator2=hi
viewer1=hello
bot=viewer1 timeout! you are spamming!

another example,
Code:
viewer1=1
moderator1=good morning
viewer1=2
@moderatornighbot=bla bla bla...
viewer1=3
bot=viewer1 timeout! you are spamming!

this code ignoring moderator texts. i dont want timeout viewers when moderators writing please fix this script
Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return } 
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3- 
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
  if ($nick isop $chan) { return }
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) { 
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }

  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}
Posted By: Fonic_Artes Re: spam protection help - 17/02/17 05:33 PM
Hmm, maybe something like this?

Code:
on *:text:*:#: {
  if ($nick isop $chan) { %spamlines = 1 }
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) { 
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }

  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}


This being inside the last half of the code, and I won't say it will work since I haven't tested it.

The basic idea though is you check if they're a moderator and if they are, reset %spamlines back to 1 or just unset %spamlines.
Posted By: Blas Re: spam protection help - 18/02/17 12:24 AM
The code that I had originally supplied has been tested and it does work for me. I will add comments in the code to help explain it.

Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3-
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
; 1) The first IF statement checks to see if the user is the last user to type anything in chat.
; If they are the last user to type anything, then the code will increase their amount of
; spamlines by 1. If this number reaches 3 (%spamlines), then this will time the user out.
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) {
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }
  }
; 2) If the last user to type anything in chat is a MOD, this will UNSET (delete) the name of the
; last user to type anything in chat (%spamnick) as well as the number of %spamlines.
; Also, because this code happens BEFORE the next 'else' statement, a MOD can NEVER be the user
; that sets the %spamnick and %spamlines. Therefor, a MOD typing anything in chat will ALWAYS
; reset the %spamnick and %spamlines variables back to 0 by UNSETing them.
  elseif ($nick isop $chan) {
    unset %spamnick
    unset %spamlines
  }
; 3) If a user is NOT a mod (because of above 'elseif' statement) and is NOT the last person to
; trigger the spam protection (because of first 'if' statement), then this statement will set
; that user as the current %spamnick variable and set the %spamlines to 1.
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}
Posted By: x3pos Re: spam protection help - 20/02/17 09:16 PM
its working thank you!
Posted By: x3pos Re: spam protection help - 26/02/17 03:31 PM
/me messages dont work help me please smile
Code:
viewer=1
viewer=2
viewer=3
bot=you are spamming

its work no problem but....
Code:
viewer=/me 1
viewer=/me 2
viewer=/me 3
Posted By: Blas Re: spam protection help - 27/02/17 02:30 AM
Sneaky viewers. :P

Tested and working. I put the spamcheck in an alias and made the alias run whenever someone in chat posts a message or does a /me (action).

Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3-
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: spamcheck $chan
on *:action:*:#: spamcheck $chan

alias spamcheck {
  if ($nick isop $1) {
    unset %spamnick
    unset %spamlines
  }
  elseif ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) {
      msg $1 .timeout $nick %spamtime %spammessage
      msg $1 $nick you're spamming too fast. slow down!
      %spamlines = 1
    }
  }
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}
Posted By: x3pos Re: spam protection help - 27/02/17 06:16 PM
sorry tested but doesnt work
© mIRC Discussion Forums