Op Yourself When Deop & UnBan Yourself When Banned

By Arch on Nov 11, 2010

When Someone Deop You, With This Snippet You Can Automatically Reop. & When Some one Ban You, With This Snippet You Can Automatically Unban.

<<Reop When Deoped>>

on 1:DEOP:#chan:{
  if ($opnick == $me) {
    cs op $chan
  }
}

<<Unban when Ban>>

on @1:BAN:#chan:{
  if ($banmask iswm $ial($me)) {
    mode $chan -b $banmask
  }
}
Sign in to comment.
chachin   -  Jan 31, 2011

never FARKING mind. I dont know wtf happend but it decided to messup my $H1T and chanserv makes me go off by making me +o forever :|

 Respond  
Gummo   -  Nov 15, 2010

For clarification, Jethro_, since it retrieves the last token in a list with : between, if the server has no : bans it will still get the wildcard correctly. :)

 Respond  
GuitarMasterx7   -  Nov 15, 2010

ah... makes sense o.O

 Respond  
Jethro   -  Nov 12, 2010

It's indeed chr 58 for colon. You're correct on the obvious if a so called special ban is set as mentioned. However, not all the chat networks support the special bans. People who know of MSL should be capable of tweaking it to their liking based on their network protocols. ^^

 Respond  
Gummo   -  Nov 12, 2010

It won't match if they place a special ban like ~q: though, so for that you could use ($gettok($2,-1,58) iswm $ial($me)) I think a colon is 58, anyway. Not checking now.

 Respond  
Jethro   -  Nov 12, 2010

That regex is to match the mode +b, (we don't want it to trigger upon -b so it has to be negated using the ^ sign) where $2 is the string of nick or ident banned under the rawmode event. In this case, we want to watch out for someone who sets a ban on the client that runs the code. The $ial($me) returns the whole address from the internal address list, sort of like $fulladdress or $address($2,5). The iswm operator is used so we can match it as a wildcard string. Once a ban is set on the client, the code will immediate get the ban unset. It doesn't matter if it's a nick, ident or host ban. The code will reverse the action.

 Respond  
GuitarMasterx7   -  Nov 12, 2010

can you explain

  elseif ($regex($1,/(\+[^\-]*b)/)) && ($2 iswm $ial($me)) {

wha dat does o.O

 Respond  
Jethro   -  Nov 12, 2010

I'd do it like this:

on @*:rawmode:#:{
  if ($mode(1).deop == $me) { mode # +o $me }
  elseif ($regex($1,/(\+[^\-]*b)/)) && ($2 iswm $ial($me)) {
    mode # $replace($regml(1),+,-) $2
  }
}
 Respond  
napa182   -  Nov 12, 2010

so if you deop ur self it op's you again.. ffs you have to love snippets with no thought to them at all. =/ also no check is you have chanserv access

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.