mIRC Homepage
Posted By: DuXxXieJ Join flood protection - 09/06/11 03:52 PM
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?
Posted By: mur_phy Re: Join flood protection - 09/06/11 04:14 PM
Code:
on *:JOIN:#:{
  inc -u10 %join. [ $+ [ $+($nick,$chan) ] ]
  if ( %join. [ $+ [ $+($nick,$chan) ] ] == 3) { 
    if ($me isop #) { kick $chan $nick Join Flood Protection }
  }
}
Posted By: Tomao Re: Join flood protection - 09/06/11 05:06 PM
To prevent the script from kicking youself, just add the ! prefix:
Code:
on !*:JOIN:#:{
That will save yourself from being kicked.
Posted By: Riamus2 Re: Join flood protection - 09/06/11 05:44 PM
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.
Posted By: mOX Re: Join flood protection - 09/06/11 05:47 PM
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.


Posted By: mOX Re: Join flood protection - 09/06/11 05:58 PM
You are right Riamus2
Posted By: Tomao Re: Join flood protection - 09/06/11 08:56 PM
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.
Posted By: Riamus2 Re: Join flood protection - 09/06/11 09:14 PM
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.
Posted By: RoCk Re: Join flood protection - 09/06/11 09:38 PM
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.
Posted By: Tomao Re: Join flood protection - 09/06/11 10:51 PM
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.
Posted By: RoCk Re: Join flood protection - 09/06/11 11:02 PM
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)
Posted By: mOX Re: Join flood protection - 10/06/11 05:30 PM
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
Posted By: Tomao Re: Join flood protection - 10/06/11 06:27 PM
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.
© mIRC Discussion Forums