mIRC Home    About    Download    Register    News    Help

Print Thread
Join flood protection #232563 09/06/11 03:52 PM
Joined: Jan 2007
Posts: 280
DuXxXieJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
Code:
on *:JOIN:#:{
  if (%join [ $+ [ $nick ] ] == $null) { 
    set -u10 %join [ $+ [ $nick ] ] 1
  }
  else {
    inc %join [ $+ [ $nick ] ]
  }
  if (%join [ $+ [ $nick ] ] >= 3) {
    if ($me isop #) { 
      kick $chan $nick Join Flood Protection 
      unset %join [ $+ [ $nick ] ] 
    }
    unset %join [ $+ [ $nick ] ] 
  }
}


This script kicks peopel who join 3 times in 10 seconds. But it's set to every channel, so if I join #chan1, #chan2 and #chan3 (all three in 10 seconds, lets say I'm using perform) it'll kick me in #chan3 (last joined, where %joinMYNAME is set to 3)

I'd like it to kick people who join 3 times in 10 seconds PER chan and not overall.

Any help?

Last edited by DuXxXieJ; 09/06/11 03:53 PM.

Squee whenever a squee squee's. Squee whenever a squee does not squee.
Re: Join flood protection [Re: DuXxXieJ] #232565 09/06/11 04:14 PM
Joined: Jun 2011
Posts: 6
M
mur_phy Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2011
Posts: 6
Code:
on *:JOIN:#:{
  inc -u10 %join. [ $+ [ $+($nick,$chan) ] ]
  if ( %join. [ $+ [ $+($nick,$chan) ] ] == 3) { 
    if ($me isop #) { kick $chan $nick Join Flood Protection }
  }
}

Last edited by mur_phy; 09/06/11 04:14 PM.
Re: Join flood protection [Re: DuXxXieJ] #232567 09/06/11 05:06 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
To prevent the script from kicking youself, just add the ! prefix:
Code:
on !*:JOIN:#:{
That will save yourself from being kicked.

Re: Join flood protection [Re: mur_phy] #232570 09/06/11 05:44 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Just to clean it up a little...

Code:
on !*:JOIN:#:{
  inc -u10 $+(%,join.,$nick,$chan)
  if ($($+(%,join.,$nick,$chan),2) >= 3) { 
    if ($me isop #) { kick $chan $nick Join Flood Protection }
  }
}


Reasons:
1) You don't need to evaluate (using []'s) when incrementing a dynamic variable. You could use %join. $+ $+($nick,$chan) using the same style that you were using. I just combined everything into $+() rather than only half.

2) $(,2) is imo better than using []'s. []'s are for order of operations and although they usually work for dynamic variable evaluation, that really isn't what their purpose is. $(,2) (short for $eval(,2)) is meant for that type of evaluation. It won't hurt in this script regardless which way you choose, of course.

3) >= instead of == ... if the person rejoins immediately after the kick, the count will be 4 and with ==, the nick won't get kicked.

4) ! on the event line ... this prevents your script from kicking you, which I doubt you want to happen.

5) You *could* use @ on the event line instead of checking isop, but in this case, I would use the isop check where you have it because the way it is now, if you aren't op and someone joins 3 times and then you become op and they join again, you'll kick them. If you use @, the /inc won't happen and so you won't start counting rejoins until you are an op. That could mean more joins before you kick the person.


Invision Support
#Invision on irc.irchighway.net
Re: Join flood protection [Re: DuXxXieJ] #232571 09/06/11 05:47 PM
Joined: Jul 2008
Posts: 12
M
mOX Offline
Pikka bird
Offline
Pikka bird
M
Joined: Jul 2008
Posts: 12
Code:
on !*@:JOIN:#:{
  inc -u10 %join. [ $+ [ $+($nick,$chan) ] ]
  if ( %join. [ $+ [ $+($nick,$chan) ] ] == 3) { 
    kick $chan $nick Join Flood Protection 
  }
}

on !*@:JOIN:#:{
  inc -u10 %join. [ $+ [ $hash($nick $chan,32) ] ]
  if ( %join. [ $+ [ $hash($nick $chan,32) ] ] == 3 ) { 
    kick $chan $nick Join Flood Protection 
  }
}

mIRC.chm
The @ prefix
You can limit events to being executed only when you have Ops on a channel by using the @ prefix.



Last edited by mOX; 09/06/11 05:47 PM.
Re: Join flood protection [Re: Riamus2] #232574 09/06/11 05:58 PM
Joined: Jul 2008
Posts: 12
M
mOX Offline
Pikka bird
Offline
Pikka bird
M
Joined: Jul 2008
Posts: 12
You are right Riamus2

Re: Join flood protection [Re: mOX] #232578 09/06/11 08:56 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Quote:
on !*@:JOIN:#:{
I've never seen people prefixed like you've done. I don't believe this is the correct form. You either use @ or ! by itself for the join event.

Re: Join flood protection [Re: Tomao] #232581 09/06/11 09:14 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah, without testing it, I'm not sure that it would work like that. My guess is that it won't. Even if it does, as I mentioned, @ isn't the best option for this particular script anyhow.


Invision Support
#Invision on irc.irchighway.net
Re: Join flood protection [Re: mOX] #232583 09/06/11 09:38 PM
Joined: Dec 2002
Posts: 2,022
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,022
I would use @*:JOIN:#: because it won't trigger for yourself since you are NOT opped when you join the channel, and it will only trigger for others if you ARE opped.

Re: Join flood protection [Re: RoCk] #232585 09/06/11 10:51 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
I was told there is no difference when you use ! or @ upon your own entry. They will stop the join event from being triggered when you join a channel.

Edit - I've gaven it a little test drive and it works without triggering my own entrance by using @ or ! by itself.

Edit again - I've just found that it renders the join event unresponsive when used with @ while you don't have an OP status.

Last edited by Tomao; 09/06/11 11:01 PM.
Re: Join flood protection [Re: Tomao] #232586 09/06/11 11:02 PM
Joined: Dec 2002
Posts: 2,022
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,022
Yes both will prevent triggering on your own entry. While ! stops there for the JOIN event, @ also does the job of ! in this case AND prevents triggering if you are not opped. Personally, I wouldn't want to count the joins if I wasn't opped, so using @ alone covers it all without having to use if ($me isop $chan)

Re: Join flood protection [Re: Tomao] #232592 10/06/11 05:30 PM
Joined: Jul 2008
Posts: 12
M
mOX Offline
Pikka bird
Offline
Pikka bird
M
Joined: Jul 2008
Posts: 12
Actually I did not realize I had not removed the prefix "!"
The idea was to add "@" to get rid of the comparison "if ($me isop #)"
The syntax "on !*@:JOIN:#:{" no is correct, but it worked the same way

Re: Join flood protection [Re: mOX] #232593 10/06/11 06:27 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
mOX, It doesn't seem correct. This is more like it:

on !@*:JOIN:#:{

But you'll only need one of them. As RoCk has mentioned they both will work to keep the join event from triggering on your own entrance to a channel.

I don't know where you get that structure from...it looks very unorthodox.

Last edited by Tomao; 10/06/11 06:31 PM.