mIRC Home    About    Download    Register    News    Help

Print Thread
#147829 24/04/06 08:33 PM
Joined: Feb 2005
Posts: 185
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Feb 2005
Posts: 185
hi guys, this is my code below, its intended for when the group is enabled, and another user set a mode in the channel, it will unset it... ie.

[21:28:00] * BrAun sets mode: -C <--- another user

[21:28:00] * Skeletor sets mode: +C <--- Me
[21:28:01] <Skeletor> please dont change the channel modes

Code:
 #modelock on

on *:mode:* {
  ;if ($nick == $me) { return }
  if (+ isin $1-) { mode # - $+ $remove($1-,+) | halt }
  elseif (- isin $1-) { mode # + $+ $remove($1-,-) | halt }
 say Please dont change the channel modes
}

#modelock end
 


But what happens is...

[21:28:02] * Skeletor sets mode: -C
[21:28:02] * Skeletor sets mode: +C
[21:28:02] * Skeletor sets mode: -C
[21:28:02] * Skeletor sets mode: +C
[21:28:02] * Skeletor sets mode: -C
[21:28:02] * Skeletor sets mode: +C
[21:28:02] * Skeletor sets mode: -C
[21:28:02] * Skeletor sets mode: +C
[21:28:02] * Skeletor sets mode: -C
[21:28:02] * Skeletor sets mode: +C
[21:28:02] * Skeletor sets mode: -C
[21:28:02] * Skeletor sets mode: +C

And it keeps doing that until, it disable the group

Any Ideas?


sub-zero.homeip.net:6667

#147830 24/04/06 08:50 PM
Joined: Jul 2005
Posts: 37
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Jul 2005
Posts: 37
the error your having is that your also setting the chan mode thats making it do a loop also it wont msg the chan cous your using halt here is a edit of your code
Code:
on *:mode:* {
  if ($me == $nick) { halt }
  if (+ isin $1-) { mode # - $+ $remove($1-,+) | msg $chan Please dont change the channel modes | halt }
  elseif (- isin $1-) { mode # + $+ $remove($1-,-) | msg $chan Please dont change the channel modes | halt }
}
 

#147831 24/04/06 09:03 PM
Joined: Feb 2005
Posts: 185
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Feb 2005
Posts: 185
Ah nice one, ta laugh


sub-zero.homeip.net:6667

#147832 24/04/06 11:11 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Code:
on !@*:MODE:#Channel:{
  if (k isin $gettok($1,1,32)) mode $chan $iif(+ isin $1,-k,+k) $gettok($1-,$numtok($1-,32),32)
  if ($2) mode $chan $replace($replace($1-,+,$chr(161),-,$chr(162)),$chr(161),-,$chr(162),+) $2-
  else mode $chan $replace($replace($1-,+,$chr(161),-,$chr(162)),$chr(161),-,$chr(162),+)
  msg $chan $nick $+ , please do not change the channel modes.
}


The !@ prefix means it will not trigger if you did it, and that you must also be opped.

The actual code, I used some obscure characters to replace every +mode with -mode and each -mode with +mode. It will work with modes that have a second parameter also (+k for example).

#147833 26/04/06 04:53 AM
Joined: Oct 2003
Posts: 48
R
Ameglian cow
Offline
Ameglian cow
R
Joined: Oct 2003
Posts: 48
this script seems similar to one script someone was writing for me. I'm wanting to remove -irm (invite only, registered, moderated) if another op modifies the mode.
Code:
on @*:MODE:#channel:{
  if ($nick != $Me) {
   var %modes = $regsubex($1,/-[^+]+/g,$null)
  if (%modes) &amp;&amp; ($regex(%modes,/\+(?:[^imr]+)?[imr]/g)) { mode $chan -irm }
}
}


but I don't know regex enough to know what this code actually means. I just want it to remove modes that are set by other ops.


Link Copied to Clipboard