mIRC Home    About    Download    Register    News    Help

Print Thread
#80950 27/04/04 10:43 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Hi there smile

Let's say i have a code similar to this one:
(syntax is /ctcp <nick> deop #chan <nick>)
Code:
ctcp 900:deop *:*: {
  if ($ulevel &lt; [color:red]$level($$3)[/color]) { .notice $nick You cannot deop users with higher access than yours. | halt }
  .
  .
  rest of the command
  .
  .
} 
I have something similar that i'm trying to put into my bot. The $level($$3) isn't working, since it only searches in the userlist for the nick of the person, and not a matching mask.

If there a way to make the script check the $$3's address and see if matches a user in the userlist?

I tried with this:
Code:
 if ($ulevel &gt; $level($address($$3,2))) { command } 
but, with this, it only looks the mask 2.

All help is welcome wink

Thank you, Zyzzy. smile


"All we are saying is give peace a chance" -- John Lennon
#80951 27/04/04 10:54 PM
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
Try this:
Code:
ctcp 900:deop *:*: {
  .
  .
  rest of the command
  .
  .
}
ctcp *:deop *:*:.notice $nick You cannot deop users with higher access than yours.


If they don't meet/exceed level 900 anyway, they won't get the first ctcp to activate.
The 2nd one would tell them that they can't use that feature.

#80952 27/04/04 11:19 PM
Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
The easiest way to get someone's level, is to pass the person's full address to $level(). You can get someone's full address using $ial(nickname) or $address(nickname,5). For example, in your case:

Code:
if ($ulevel &lt; $level($ial($$3))) { ... }


Saturn, QuakeNet staff
#80953 27/04/04 11:20 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Hmm.. that wasnt quite was i was looking for.. smile

In the bot i have levels, like 900 are Managers, 500 are Regular Ops, 1000 is the owner, 300 voices and so on..

I want something that prevents the person from deopping another user with lower or equal access they've got.

For example, 600 can only deop 599 and lower; 900 only 899 and lower, and etc.

smile


"All we are saying is give peace a chance" -- John Lennon
#80954 27/04/04 11:46 PM
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
Code:
ctcp 300:deop *:*: {
  if (  !$botrank($3) ) { .notice $nick $3 outranks you, you may not deop them. | return }
  .
  .
  rest of the command
  .
  .
}
ctcp 2:deop *:*:.notice $nick You cannot deop users with higher access than yours.
alias botrank {
  var %me = $replace($level($fulladdress),$chr(44),$chr(32))
  var %victim = $replace($level($address($1,5)),$chr(44),$chr(32))
  var %x = 0, %y = 0
  while ( %me ) {
    if ( %x &lt; $gettok(%me,1,32) ) { %x == $gettok(%me,1,32) }
    var %me == $deltok(%me,1,32)
  }
  while ( %victim ) {
    if ( %y &lt; $gettok(%victim,1,32) ) { %y == $gettok(%victim,1,32) }
    var %victim == $deltok(%victim,1,32)
  }
  if ( %x &gt;= %y ) { return $true }
  return $false
}


I haven't tested it, but that should work.

#80955 27/04/04 11:49 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, it works great! laugh

I used $address(nickname,5) instead of the $ial because the IAL may not be updated, but ill always get the $address wink

Thanks for the help you both!

Zyzzy. laugh


"All we are saying is give peace a chance" -- John Lennon
#80956 27/04/04 11:53 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
*deleted* (I was too late once more)

Last edited by qwerty; 27/04/04 11:56 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#80957 27/04/04 11:57 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
No, $address() (NOT $address) relies on the IAL, so either both $address() and $ial() work or neither of them.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#80958 27/04/04 11:59 PM
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
My understanding is that if $ial doesn't have it, then $address won't either. $ial(nickname) would actually be easier, I think, than $address(nickname,5) as I was using.

And are you using the code I put up (if so is it working? Like I said it's untested).

Reason for the extra botrank code is to consider those users with multiple levels.
smile

#80959 28/04/04 12:07 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, i see... so $address() and $ial() do the same thing smile

btw, that script didnt work very well.. the client freezed smirk


"All we are saying is give peace a chance" -- John Lennon
#80960 28/04/04 12:26 AM
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
$address looks up the nick in the $ial, and then applies the $mask function to it.

$mask($ial($nick),2) would return *!*@host for example.
$address($nick,2) does the same thing but is easier.
$ial($nick) and $address($nick,5) are the same thing smile

and as for the script not working.. :-\ it should but like I said, I didn't test it so.. oh well.

#80961 28/04/04 12:31 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, cool smile Didnt know those 2 were connected :P


"All we are saying is give peace a chance" -- John Lennon
#80962 28/04/04 05:52 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Btw.. does that work with IBL too? For example, if i have a script that goes:
Code:
alias unban {
  mode $chan -b $address($$1,5)
}


Would it look up in the IBL for a matching address of the nick?

Thanks, Zyzzy. smile


"All we are saying is give peace a chance" -- John Lennon
#80963 28/04/04 06:19 PM
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
In the matter of not being able to search the IBL, yes.

Code:
if ( !$chan(#).ibl ) { echo -a # : Internal Ban List is empty! }
if ( !$chan(#).ial ) { echo -a # : Internal Address List is empty! }


That's just a simple example of testing the IAL/IBL for a room.

For your script, if you ever have problems flooding off, and wish to help reduce that risk (as an example, one unban is small scale, really)...
Code:
alias unban {
  if ( !$chan(#).ibl ) { mode # -b $ial($1) | return }
  if ( $ial($$1) !isban ) { return }
  var %x = $ibl(#,0), %b, %a = %ial($1)
  while (%x) { if ($ibl(#,%x) iswm %a) { var %b = %b $ibl(#,%x) } | dec %x }
  if ( %b ) { mode # $+(-,$str(b,$numtok(%b,32))) %b }
}

More work than it's really worth in some ways, but if you go to unban someone, that *should* lift all the bans related to that person if the ibl is filled for that channel.
grin

#80964 28/04/04 06:36 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I have a problem with this line:
Code:
  if ( $ial($$1) !isban ) { return }


It tells me /if: invalid format

But, if i take that line out of the script, it works perfect! laugh

Oh, btw.. i tested it on an empy channel. I joined, banned the nick with 3 different masks (like nick!*@* and *!*identd*@*) and, when i checked for the existance of IBLwith if ( !$chan(#).ibl ) { echo -a # : Internal Ban List is empty! }, it warned me it was empty, even if I was the one setting the bans!

Thanks, Zyzzy. smile


"All we are saying is give peace a chance" -- John Lennon
#80965 28/04/04 06:49 PM
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
I keep messing that up, sorry...
Code:
alias unban {
  if ( !$chan(#).ibl ) { mode # -b $ial($1) | return }
  if ( $ial($$1) !isban # ) { return }
  var %x = $ibl(#,0), %b, %a = %ial($1)
  while (%x) { if ($ibl(#,%x) iswm %a) { var %b = %b $ibl(#,%x) } | dec %x }
  if ( %b ) { mode # $+(-,$str(b,$numtok(%b,32))) %b }
}

Try that.. I forgot the # in that line you had a problem with.
grin
The purpose of that line is to cut down on script usage. Why search the ibl if it's there are no matching bans?

#80966 28/04/04 07:04 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Works perfectly! laugh

Thanks for the help, i learnt quite a few tips with that script wink

Grettings, Zyzzy.


"All we are saying is give peace a chance" -- John Lennon

Link Copied to Clipboard