mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2021
Posts: 169
Simo Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2021
Posts: 169
Hey there,

i was trying out this ban enforcer and couldnt get it to halt when the amount of nicks the banmask matched exceeds 2

the : if (%kick) { kick $chan %kick «-Banned-» } still executes anuway to halt that as well when $numtok(%kick,44) > 2.


Code

ON *:ban:#test:{ 
  if ($nick(#,$me,~&@%)  || o isin $usermode ) { 
    var %ixz = 1 
    while ($ialchan($banmask,$chan,%ixz).nick != $null)  { 
      var %user =  $v1
      if (!$nick($chan, %user ,@&%+) && !$istok( $me , %user ,32)  && %user ison $chan) { var %kick = $addtok(%kick,%user,44) }
      if ($numtok(%kick,44) > 2) { break | mode $chan -b $banmask | unset %kick }
      if ($numtok(%kick,44) == 4) { kick $chan  %kick «-Banned-» | unset %kick }
      inc %ixz 
    }
    if (%kick) { kick $chan  %kick «-Banned-» }
  }
}




Joined: Nov 2021
Posts: 169
Simo Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2021
Posts: 169
So any help with this?

Joined: Jul 2006
Posts: 4,037
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,037
/break breaks out of the while loop, it does not halt the code like /halt or /return
If you want the code to keep running, you can keep using /break but set a bool variable when your condition is true and check that this variable is not set prior checking if (%kick)..


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2021
Posts: 169
Simo Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2021
Posts: 169
Thanks wims for your reply, altho i dont know how to do what you suggested

Joined: Jul 2006
Posts: 4,037
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,037
Well in fact I checked the code again and it is unsetting %kick after the /break, meaning that the if (%kick) part after the while loop should never get executed.

Edit: Most likely you described the problem incorrectly, what is triggering the kick is that last condition inside the while loop:
if ($numtok(%kick,44) == 4) { kick $chan %kick «-Banned-» | unset %kick }
and not the if (%kick) stuff outside, after the while loop

The overall logic of your event is unclear anyway, what is it that you want to do with nick affected by a ban ?

Last edited by Wims; 1 hour ago.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard