mIRC Home    About    Download    Register    News    Help

Print Thread
#71748 17/02/04 08:53 PM
Joined: Feb 2003
Posts: 7
N
Niluje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Feb 2003
Posts: 7
I was trying to make an alias that could be called by certains events, but it always failed. Here is the code :
Code:
checkop {
  ;$1 is the name of the chan
  if ($me isop $1) {
    set %i $line($1,0,1) | set %op 
    while (%i > 0) {
      if ($line($1,%i,1) !isop $1) { set %op $addtok(%op,$line($1,%i,1),46) }
      dec %i
    }
    while ($numtok(%op,46) > 0) {
      mode $1 +o $gettok(%op,$numtok(%op,46),46)
      set %op $deltok(%op,$numtok(%op,46),46)
    }
    unset %i | unset %op
  }
}

When only one person had to be opped, this was fine. But I don't know why, sometime, when multiple persons quitted, the script kept opping. But the token should be empty, so the script couldn't have more nicks to op !
Can someone help me ? grin

#71749 17/02/04 09:39 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
are u saying it opped the people that had quit ?

if so thats becasue it well have acted on a list of nicks that wasnt being updated untill after the script completed.

#71750 17/02/04 09:51 PM
Joined: Feb 2003
Posts: 7
N
Niluje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Feb 2003
Posts: 7
No, no, no. After a netsplit (when they come back), or when I join (and someone auto-op me), there is generally people not opped. They are the people that has to be opped.

#71751 18/02/04 05:08 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
well i cant understand what you were saying about your script then as it would appear to do that, I did however try it on a channel with alot of people and it crashed due to string length, heres a script that should work all the time.

Code:
 
checkop {
  ;$1 is the name of the chan
  if ($me isop $1) {
    var %i = $line($1,0,1)
    while (%i > 0) {
      if ($line($1,%i,1) !isop $1) {
        mode $1 +o $line($1,%i,1)
      }
      dec %i
    }
  }
}
 

#71752 18/02/04 05:32 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
It would be better to use $modespl here to reduce the amount of lines sent... smile
Code:
checkop {
  if $me !isop $1 { return }
  var %i = 1,%a
  while $nick($1,%i,a,o) {
    var %a = %a $ifmatch
    if $modespl // %i { mode $1 $str(o,$ifmatch) %a | var %a }
    inc %i
  }
  if $numtok(%a,32) { mode $1 $str(o,$ifmatch) %a }
}

#71753 18/02/04 05:52 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
yeah i just tried to reduce his script, so he might see where he could have improved, rather than giving a script using a bunch of things he might not know of. Not that there was anything wrong with your script of course, and i did wonder about a huge burst of modes being sent, but thought well he was going to do that anyway so who cares smile

#71754 18/02/04 08:06 PM
Joined: Feb 2003
Posts: 7
N
Niluje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Feb 2003
Posts: 7
Thanks a lot, although I didn't understand what is the $modespl identifier... I both didn't understand the explanation in the help, and the use you made of it in the alias, but thanks. I'll try this, and see if it work. grin

#71755 18/02/04 08:14 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
$modespl is simply the amount of modes you can set in 1 line -Modes Per Line

The default value is 3, but if a server/network allows more than 3 they can let clients know on connecting as part of Raw 005.


Link Copied to Clipboard