mIRC Home    About    Download    Register    News    Help

Print Thread
Auto Voice if nick is an Oper #181387 22/07/07 06:55 PM
Joined: Apr 2004
Posts: 27
P
parvez Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2004
Posts: 27
Hi! (damn..it's been a long time since i came here)

I need help again. I want a code that will give +v to anyone who is an oper and join #support.

For example:
Method 1: If John is an oper in the server and he joins #support then I should whois him and see that "John is an operator" and then +v him automatically. That means I will whois "anyone" who joins #support to check if they're an oper or not.

Method 2: I am a service administrator. So is it possible for me to whois and check their usermodes and based on that, I will give +v automatically?

I really need the code. Thank you! I'll reply back asap.


Re: Auto Voice if nick is an Oper [Re: parvez] #181388 22/07/07 07:11 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On @*:Join:#support: {
  .enable #Oper
  who $nick
}

#Oper off
Raw 352:*: { 
  if (* isin $7) {
    mode #support +v $6
  }
  halt
}
Raw 315:*: {
  .disable #Oper
  halt
}
#Oper end


A more simplistic approach to check if they're an oper is to check their oper host maybe.

Re: Auto Voice if nick is an Oper [Re: SladeKraven] #181391 22/07/07 07:23 PM
Joined: Apr 2004
Posts: 27
P
parvez Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2004
Posts: 27
Dude!!

You are a true genius. It worked. Thank you so much. I appreciate the help.

Re: Auto Voice if nick is an Oper [Re: parvez] #181392 22/07/07 07:25 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
No need to use /whois for this, as /who will return the proper codes
Code:
on @*:join:#support:{
  .enable #voice_check
  .who $nick
}
#voice_check off
raw 352:*:{
  if $chr(42) isin $7 {
    .mode #support +v $6
  }
}
raw 315:*:{
  .disable #voice_check
  haltdef
}
#voice_check end


Beat by SladeKraven..oh well, had to happen sometime

Last edited by RusselB; 22/07/07 08:29 PM.
Re: Auto Voice if nick is an Oper [Re: RusselB] #181393 22/07/07 07:29 PM
Joined: Apr 2004
Posts: 27
P
parvez Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2004
Posts: 27
Both codes worked. Thanks again!

Re: Auto Voice if nick is an Oper [Re: RusselB] #181416 23/07/07 02:38 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Recently, while making a script that accesses /who raw data, I have discovered that you can't reliably /who $nick to get the results you are looking for. Example:

If you do /who frank, the server will reply with all the users who have frank as their nick, ident, or realname. The simplest reliable method I've found is to use the /userhost $nick command.

Here is my code that parses RAW 302 (/userhost response):

Code:
  var %c = 1, %cc = $0
  while (%c < %cc) {
    inc %c
    ; REGEX: (nick)(*=+)(ident)@(host)
    noop $regex($gettok($1-,%c,32),/(.+?)(\*?\=[+-])(.+?)@(.+)/)

    echo -a .Nick: $regml(1) 
    echo -a .Mode: $regml(2)
    if (* isin $regml(2)) echo -a Oper: Yes
    else echo -a Oper: No
    if (- isin $regml(2)) echo -a Away: Yes
    elseif (+ isin $regml(2)) echo -a Away: No
    echo -a Ident: $regml(3) 
    echo -a .Host: $regml(4)
  }



The while loop is included because /userhost can support multiple nicks, so RAW 302 can return multiple sets of data.

Here is the equivalent of your code, except using USERHOST:

Code:
on *:JOIN:#support:{
  if ($me isop $chan) {
    set -u5 $+(%,UH.,$nick) 1
    userhost $nick
  }
}

RAW 302:*:{
  var %c = 1, %cc = $0
  while (%c < %cc) {
    inc %c
    ; REGEX: (nick)(*=+)(ident)@(host)
    noop $regex($gettok($1-,%c,32),/(.+?)(\*?\=[+-])(.+?)@(.+)/)
    tokenize 32 $regml(1) $regml(2) $regml(3) $regml(4)
    if ($($+(%,UH.,$1),2)) {
      if ((* isin $2) && ($1 ison #support)) .mode #support +v $1
      unset $+(%,UH.,$1)
      haltdef
    }
  }
}



-genius_at_work

Re: Auto Voice if nick is an Oper [Re: genius_at_work] #181447 23/07/07 06:58 PM
Joined: Apr 2004
Posts: 27
P
parvez Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2004
Posts: 27
Wow. So many ways to approach to this command. Thank you!!