mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#232563 09/06/11 03:52 PM
D
DuXxXieJ
DuXxXieJ
D
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.
M
mur_phy
mur_phy
M
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.
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
To prevent the script from kicking youself, just add the ! prefix:
Code:
on !*:JOIN:#:{
That will save yourself from being kicked.

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
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.

M
mOX
mOX
M
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.
M
mOX
mOX
M
You are right Riamus2

Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
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.

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
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.

Joined: Dec 2002
Posts: 1,996
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 1,996
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.

Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
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.
Joined: Dec 2002
Posts: 1,996
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 1,996
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)

M
mOX
mOX
M
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

Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
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.
Joined: May 2022
Posts: 119
F
Vogon poet
Offline
Vogon poet
F
Joined: May 2022
Posts: 119
Originally Posted by DuXxXieJ
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 ] ] 
  }
}

Does it works just on nick or does it consider the whole mask? I mean: an user may join flood with the different nicks but same host. Does it consider this option? Thanks

Joined: Nov 2021
Posts: 152
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 152
try this Fernet :

Code

on !*:JOIN:#:{
  if ($nick($chan,$me,~&@%)) { 
    if (%JoinPartFlood. [ $+ [ $wildsite ] $+ . $+ [ $chan ] $+ . $+ [ $network ] ] == $null ) { set -u10 %JoinPartFlood. [ $+ [ $wildsite ] $+ . $+ [ $chan ] $+ . $+ [ $network ] ] 1   }
    else { inc %JoinPartFlood. [ $+ [ $wildsite ] $+ . $+ [ $chan ] $+ . $+ [ $network ] ]  }
    if (%JoinPartFlood. [ $+ [ $wildsite ] $+ . $+ [ $chan ] $+ . $+ [ $network ] ] == 3) {
      if ($wildsite !isban $chan) { mode $chan +b $wildsite }
      if ($nick ison $chan) { kick $chan $nick Join-Part-Flood }
      unset %JoinPartFlood. [ $+ [ $wildsite ] $+ . $+ [ $chan ] $+ . $+ [ $network ] ]
    }
  }
}





Last edited by Simo; 05/05/25 11:21 PM.
Joined: Nov 2021
Posts: 152
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 152
a little bit cleaner version :

Code

on !*:JOIN:#:{
  if ($nick($chan,$me,~&@%)) { 
    if ($+(%,JoinPartFlood_,$site,_,$chan) == $null ) { set -u10 $+(%,JoinPartFlood_,$site,_,$chan) 1   }
    else { inc $+(%,JoinPartFlood_,$site,_,$chan)  }
    if ($($+(%,JoinPartFlood_,$site,_,$chan),2) == 3) {
      if ($wildsite !isban $chan) { mode $chan +b $wildsite }
      if ($nick ison $chan) { kick $chan $nick Join-Part-Flood }
      unset $+(%,JoinPartFlood_,$site,_,$chan)
    }
  }
}



Joined: May 2022
Posts: 119
F
Vogon poet
Offline
Vogon poet
F
Joined: May 2022
Posts: 119
Originally Posted by Simo
a little bit cleaner version :

Code

on !*:JOIN:#:{
  if ($nick($chan,$me,~&@%)) { 
    if ($+(%,JoinPartFlood_,$site,_,$chan) == $null ) { set -u10 $+(%,JoinPartFlood_,$site,_,$chan) 1   }
    else { inc $+(%,JoinPartFlood_,$site,_,$chan)  }
    if ($($+(%,JoinPartFlood_,$site,_,$chan),2) == 3) {
      if ($wildsite !isban $chan) { mode $chan +b $wildsite }
      if ($nick ison $chan) { kick $chan $nick Join-Part-Flood }
      unset $+(%,JoinPartFlood_,$site,_,$chan)
    }
  }
}



I will try it, thanks Simo.

Code
 { set -u10 $+(%,JoinPartFlood_,$site,_,$chan) 1   }

Is this number of join allowed? ( I need 3 times )

And where tu set ban time? ( I need i.e. 10 hours / 36000 sec )

Joined: Nov 2021
Posts: 152
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 152
this part gets the times joined in 10 seconds :

Code
    if ($($+(%,JoinPartFlood_,$site,_,$chan),2) == 3) { 

you could try this with the added timed ban for 10hours ( keep in mind you have to be actually at least 10 hours in the channel for your client to execute the set time ban if you exit irc before setting it is useless) as you wont be in channel to have your client execute it

Code


on !*:JOIN:#:{
  if ($nick($chan,$me,~&@%)) { 
    if ($+(%,JoinPartFlood_,$site,_,$chan) == $null ) { set -u10 $+(%,JoinPartFlood_,$site,_,$chan) 1   }
    else { inc $+(%,JoinPartFlood_,$site,_,$chan)  }
    if ($($+(%,JoinPartFlood_,$site,_,$chan),2) == 3) {
      if ($wildsite !isban $chan) {  ban -u $+ $duration(10h)  $chan $nick 2   }
      if ($nick ison $chan) { kick $chan $nick Join-Part-Flood }
      unset $+(%,JoinPartFlood_,$site,_,$chan)
    }
  }
}



Joined: May 2022
Posts: 119
F
Vogon poet
Offline
Vogon poet
F
Joined: May 2022
Posts: 119
Originally Posted by Simo
this part gets the times joined in 10 seconds :

Code
    if ($($+(%,JoinPartFlood_,$site,_,$chan),2) == 3) { 

Where is 10 seconds? Is maybe here----> { set -u10 $+(%,JoinPartFlood_,$site,_,$chan) 1 } ?
My rules should has to be 3 joins allowed in 30 minutes (1800 sec).
So maybe I can write this?

Code


on !*:JOIN:#:{
  if ($nick($chan,$me,~&@%)) { 
    if ($+(%,JoinPartFlood_,$site,_,$chan) == $null ) { set -u1800 $+(%,JoinPartFlood_,$site,_,$chan) 1   }
    else { inc $+(%,JoinPartFlood_,$site,_,$chan)  }
    if ($($+(%,JoinPartFlood_,$site,_,$chan),2) == 3) {
      if ($wildsite !isban $chan) {  ban -u $+ $duration(10h)  $chan $nick 2   }
      if ($nick ison $chan) { kick $chan $nick Join-Part-Flood }
      unset $+(%,JoinPartFlood_,$site,_,$chan)
    }
  }
}



Joined: May 2022
Posts: 119
F
Vogon poet
Offline
Vogon poet
F
Joined: May 2022
Posts: 119
Finally I did this:

Code
on !*:JOIN:#CHANNEL:{
  if ($nick($chan,$me,~&@%)) { 
    if ($+(%,JoinPartFlood_,$site,_,$chan) == $null ) { set -u1800 $+(%,JoinPartFlood_,$site,_,$chan) 1   }
    else { inc $+(%,JoinPartFlood_,$site,_,$chan)  }
    if ($($+(%,JoinPartFlood_,$site,_,$chan),2) == 3) .timerwarn 1 3 notice $nick WARNING!!!
    if ($($+(%,JoinPartFlood_,$site,_,$chan),2) > 3) {
      if ($wildsite !isban $chan) {  ban -u $+ $duration(10h)  $chan $nick 2 | /write banemule.txt $date $time *Join_Flood* $chan $nick  }
      if ($nick ison $chan) { kick $chan $nick YOU BEEN WARNED (Part/Join }
      unset $+(%,JoinPartFlood_,$site,_,$chan)
    }
  }
}

I added a warn when part/join == 3 and ban on >3 (so 4 :-P )
And added a /WRITE to have ban log in a text file
Just a problem: operators ~&@%+ get banned. Maybe I have to add:
Code
if ($nick isop %chan) { halt } 
???

Does isop cover all levels (~&@%+) except 0?

Thanks a lot ;-)

Last edited by Fernet; 08/05/25 03:55 PM.
Page 1 of 2 1 2

Link Copied to Clipboard