mIRC Homepage

Mode Lock Down Script

Posted By: Skeletor

Mode Lock Down Script - 24/04/06 08:33 PM

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?
Posted By: gans

Re: Mode Lock Down Script - 24/04/06 08:50 PM

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 }
}
 
Posted By: Skeletor

Re: Mode Lock Down Script - 24/04/06 09:03 PM

Ah nice one, ta laugh
Posted By: schaefer31

Re: Mode Lock Down Script - 24/04/06 11:11 PM

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).
Posted By: r00ted

Re: Mode Lock Down Script - 26/04/06 04:53 AM

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.
© 2022 mIRC Discussion Forums