mIRC Home    About    Download    Register    News    Help

Print Thread
#259938 13/02/17 03:10 PM
Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
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.

Last edited by x3pos; 13/02/17 03:14 PM.
Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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
  }
}

Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
Sorry did not work this code.

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
I'm not sure what you were asking then. smirk

Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
No you understand what I ask but the code did not work

Joined: Jun 2015
Posts: 84
F
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
Lemme see if I can understand.

Do you want it to time out moderators for spamming, or just regular viewers?

Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
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
  }
}

Last edited by x3pos; 17/02/17 02:53 AM.
Joined: Jun 2015
Posts: 84
F
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
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.

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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
  }
}

Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
its working thank you!

Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
/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

Last edited by x3pos; 26/02/17 06:38 PM.
Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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
  }
}

Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
sorry tested but doesnt work


Link Copied to Clipboard