Simple Modes

By TMFKSOFT on May 30, 2011

A friend of mine was showing off a script he had
I've seen it before..
Where he can type +o NICK and give a user ops.

So to pass 5mins i made this.
Use +[Mode]
to Set any mode!
Set a users access mode +o NICK
or channel mode +k Password

Leave the second parameter blank to set it on yourself
e.g. +o

The first Parameter must be two letters long and start with a + or -
I admitt theres room for improvement.
I find it quick enough to use :) hope you do!

on 1:INPUT:#:{
  if ($len($1) == 2) {
    if ($chr(43) isin $1) {
      if ( $2 == $null ) {
        mode # $1 $me
        HALT
      }
      else {
        mode # $1 $2
        HALT
      }
    }
    elseif ($chr(45) isin $1) {
      if ( $2 == $null ) {
        mode # $1 $me
        HALT
      }
      else {
        mode # $1 $2
        HALT
      }
    }
  }
}

Comments

Sign in to comment.
Jethro   -  Sep 05, 2011

Well, it didn't have to be regex:

on *:input:#:{
  if ($istokcs(+o -o,$1,32)) {
    if (!$nick(#,$me,&~)) {
      notice $me I need to be an admin or owner to use this script.
    }
    else {
      mode # $1 $iif(!$2,$me,$2)
    }
  }
}
 Respond  
TMFKSOFT   -  Sep 05, 2011

Well im useless at Regex so i made it the hard way.

 Respond  
Jethro   -  May 30, 2011
on *:input:#:{
  if $regex($1,/^([+-])(o)$/) {
    if !$nick(#,$me,&~) { 
      notice $me I need to be an admin or owner to use this script.
    }
    else {
      var %m $+($regml(1),$regml(2))
      mode # %m $iif(!$2,$me,$2)
    }
  }
}

Though you can just use an alias for this in place of a input event.

 Respond  
TMFKSOFT   -  May 30, 2011

But wouldnt users that are not net admins not think to use +o on themselves.
If anything requires revision it'd be the description
after all its 8:19am in the uk i haven't slept yet!

 Respond  
napa182   -  May 30, 2011

yes when you are a net admin you seem to forget that others cant do modes as you can. So it would be wise to revise ur snippet so others that are not a net admin can use it.

 Respond  
TMFKSOFT   -  May 30, 2011

Its useful if your a server admin and have can_override
Which i find useful in my network mainly and a few others
Thats why :P

 Respond  
Jethro   -  May 30, 2011

The halt command can be discarded. It's purposeless. One question remains:
How are you supposed to give yourself:

mode # $1 $me

when you're not opped?

 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.