mIRC Homepage
Posted By: state auto op help - 20/03/09 03:27 PM
Hello,

Whats wrong with this? it works apart from if i am opped it searches for gavsta and then checks his ip to make sure it is him befor ei op

Code:
on op:JOIN:#:{
  if ($me isop $chan) {
    mode $chan +o $nick
  }
  else {
    set %opidle $nick
    msg juicer op pass
    .timeropidle 1 10 mode # +o %opidle
  }
}

on *:RAWMODE:#:{
  if (+o isin $1) && ($me isin $2) { 
    whois gavsta
  }
}

raw 338:*: {
  haltdef
  if (194.203.84.231 isin $1) {
    mode # +o gavsta
  }
}
Posted By: Horstl Re: auto op help - 20/03/09 03:49 PM
I have some problems understanding your request and the code in particular. What's the idea for the timer, the rawmode event...? I'm not familiar with raw No. 338 either.
Do you want to give some user ops in every common channel he's joining, if his IP is "194.203.84.231"? If yes - what is the user's hostmask (the part after @ in nick!ident@host)? If the IP of the user is a static one, he should have a static host as well.
Posted By: state Re: auto op help - 20/03/09 04:02 PM
I hardly ever script. so i just kinda made up the code to how i thought it would work

the timer is just a 10second delay so that if a user on the op list joins i want to op him, but if im not an op i will message juicer(are bot) to op me then op the user after a 10second delay just in case there is a slight server lag


raw 338 is just part of a whois reply

15:23                 :194.203.84.231 actually using host

basically when ever i am 'oped' i want to op every one on my op list

The hosts are

op:*!*gavsta@post.coopervision.eu.com
op:*!*ident@cpc2-cmbg6-0-0-cust862.cmbg.cable.ntl.com
op:*!*gavsta@194.203.84.231
Posted By: Horstl Re: auto op help - 20/03/09 04:46 PM
I made it check all the users in the channel for being on your op list, if you get ops after requesting it. Untested - hope it works smile
Code:
; if someone joins a channel that is on your op list, and it's not yourself joining (the ! prefix)
on !op:join:#: { 

  ; you're oped: give op tp that nick
  if ($me isop $chan) { mode # +o $nick }

  ; you're not oped
  else {

    ; set a variable "%oprequest.<channel>" to remember "I requested ops here"
    ; the variable unsets after 10 seconds
    set -eu10 $+(%,oprequest.,#) 

    ; and request ops
    msg juicer op pass
  }
}

; you get ops in a channel
on me:*:op:#: {

  ; it's by request (there was a variable set)
  if ($var($+(oprequest.,#))) {

    ; loop the addresses of all users in this channel (internal address list)
    var %n = 1
    while ($ialchan(*,#,%n)) {

      ; if the address of the currently looped user matches a mask in the users list with level "op"
      if ($ulist($v1,op)) {

        ; nick is the first chr-33 delimited token of the address
        var %nick = $gettok($ialchan(*,#,%n),1,33)

        ; if this nick isn't already oped: give ops to that nick
        if (%nick !isop #) { mode # +o %nick }

      }
      inc %n
    }
  }
}

(You can remove all the comments of course)


Alternatively, for
Quote:
basically when ever i am 'oped' i want to op every one on my op list

Code:
on me:*:op:#: {
  var %n = 1
  while ($nick(#,%n,a,o)) {
    if ($ulist($ial($v1),op)) { mode # +o $nick(#,%n,a,o) }
    inc %n
  }
}

if you get ops it loops the non-opped users of the channel and gives op to those who match your oplist. Won't trigger for joining users of course. Also note that it's using the internal address list again, which may not hold addresses of users who joined before you did and said/did nothing since then. Especially don't expect it to work if you get ops right after joining.
Posted By: state Re: auto op help - 21/03/09 10:47 AM
it dont work mate ????
Posted By: Horstl Re: auto op help - 21/03/09 12:11 PM
Hum, please try the following, modified code. I added some echoes for debugging purposes - please depict what's happening (or isn't happening) and which of the echoes you see.
Code:
on !op:join:#: { 
  ECHO # * Join: $nick is oplisted 
  if ($me isop #) { mode # +o $nick }
  elseif (!$var($+(oprequest.,$cid,.,#))) {
    ECHO $chan * requesting op from juicer
    set -eu10 $+(%,oprequest.,$cid,.,#) 
    msg juicer op pass
  }
}

on !*:join:#: { ECHO # * Join: $nick isn't oplisted }

on me:*:op:#: {
  ECHO # * Got ops. Users: $nick(#,0) • Unoped: $nick(#,0,a,o) • In internal address list: $ialchan(*,#,0) • Oplist masks: $ulist(*,op,0) 

  var %always.op.oplist = $true

  if ((%always.op.oplist == $true) || ($var($+(oprequest.,$cid,.,#)))) {
    ECHO # * checking for oplisted users - $iif(%always.op.oplist,always,op requested)
    var %n = 1
    while ($nick(#,%n,a,o)) {
      if ($ulist($ial($v1),op)) {
        ECHO # * $nick(#,%n,a,o) oplisted
        mode # +o $nick(#,%n,a,o)
      }
      inc %n
    }
  }
}

The variable %always.op.oplist determines in which case the script will check for oplisted users:
- if you put "$true" there, it will check the users of the channel everytime you get ops
- if you don't put "$true", it will check only if you got this @ because you did request it from "juicer" in the last 10s (because an oplisted user joined while you didn't have @)

You can remove the second on join event and the ECHO lines if it's working as expected.
Posted By: state Re: auto op help - 21/03/09 03:23 PM
the onjoin works. i get all the echos. But i dont get any echos if i am oped

on me:*:op:#: { is not working

It is being very strange. In the room im testing in there is Me, Juicer(are bot) and 2 test nicks. If i am opped it does nothing. But if i op juicer who is not on the op list it will op eveyr one who is on the list
Posted By: Horstl Re: auto op help - 21/03/09 03:34 PM
You're right - this won't trigger if you're oped but if you're giving op to someone. Sorry smile Instead, use:
Code:
on *:op:#: {
  if ($opnick == $me) {
    -- rest of on op event --
  }
}
Posted By: Tomao Re: auto op help - 21/03/09 03:44 PM
on me:*:op:#: { echo -a true }
does work though. I op myself and it echos true.
Posted By: Horstl Re: auto op help - 21/03/09 03:54 PM
Exactly the pitfall I stepped into, doing only a quick test on myself with 2 scons which worked - but by triggering "me gives op", not the intended "me gets op"
Posted By: Tomao Re: auto op help - 21/03/09 04:12 PM
Ah..I see. So this works the same as "me gives op" then:
Code:
on @*:RAWMODE:#: {
  if ($1 === +o) && ($2 != $me) {
    ....
  }
}
Posted By: Horstl Re: auto op help - 21/03/09 04:35 PM
Only if a single +o is issued - which isn't always the case, mode strings may be quite complex.
mIRC parses mode strings fine so we can make use of all the supported on *something* events, and I'd go for on rawmode only if really required (that is to parse modes that have no disctinct event). hixxy made a nice script for this smile
Posted By: state Re: auto op help - 21/03/09 06:24 PM
works great. thanks for your time.

some reason though it works on every nick but ignores gavst4. Strange. his address is in the user list
Posted By: Horstl Re: auto op help - 21/03/09 07:10 PM
The script compares every user (their addresses, out of the internal address list) to the op-leveled addresses of your users list. If the address in the users list is correct, I assume he isn't in mIRCs internal address list yet (joining before you did, and did/say nothing in any common channel or query).
You can check this with //echo -a address: $ial(gavst4)
Posted By: state Re: auto op help - 22/03/09 12:14 AM
i got it working. for some reason again thats weird

Control
.Add:/auser op $address($$1,1)

works on every nick, but was not adding gavst4

i had the echo stopped so could not tell if the user was added or not. as i assumed it was added.

* /auser: insufficient parameters was what mirc was saying for gavst4

which is odd again as the same code works for ever one else.

so i manually added the host and it works fine

Posted By: argv0 Re: auto op help - 22/03/09 03:12 AM
it's not "weird" unless you completely ignored Horstl's post. it won't only be that nick, and unless you start properly dealing with IAL it *will* happen in the future.
Posted By: DJ_Sol Re: auto op help - 22/03/09 04:03 PM
Maybe I missed someone explaining this. Sorry if I am giving redundant info.

The IAL collects users information when they join or do any action which sends an event to your mirc. (text,mode, etc)

What this means is when you join a room and they are idle, not doing anything, they won't be entered into your IAL. (They means anyone in the room)

To fix this you should who the channel when you join.

Now keep in mind, if you have a lot of people in the room it may flood you out. Or if you join several large rooms at once and automatically who all the channels at once. You may need to devise a queu system to slow down the incoming information.

This is the basic idea.

on me:*:join:#:who #
Posted By: state Re: auto op help - 23/03/09 07:24 PM
thanks eveyr one.

sol: thank you. to me it was weird as im not a scripter. but you just made it make sense to me. mirc was not oping gavsta when i joined the channel and got opped. but by now /who the channel on join it is finding him

thank you
© mIRC Discussion Forums