mIRC Homepage
Posted By: Xuxa Echo if I'm not an op... - 15/01/05 05:16 AM
Hi everybody!

Sorry if this is a simplistic question but I'm new at this.

I have the script below to automatically kick/ban clones.

If I'm an op it will kick/ban a clone when it joins and it will echo the address and nicks.

If I'm not an op it obviously can't kick/ban but it also doesn't echo the address and nicks of a joining clone.

How can I make it echo the address and nicks of a joining clone if I'm not an op?

Thanks!

Code:
on @*:JOIN:#:{
  if ($ial == $false) .ial on
  if ($chan(#).ial == $false) { who # | return }
  var %total = $ialchan($wildsite,#,0)
  if (%total > 1) {
    ban # $nick 2
    var %i = 0
    while (%i < %total) {
      inc %i
      var %nick = $ialchan($wildsite,#,%i).nick
      var %all.nicks = $addtok(%all.nicks,%nick,32)
      if (%nick !isop #) {
        kick # %nick Clone detected from $wildsite ( $+ %total users)
      }
    }
    echo 14 -a Clone detected from $wildsite $+ : %all.nicks
  }
}
Posted By: SladeKraven Re: Echo if I'm not an op... - 15/01/05 05:22 AM
Ok, this is untested.
Code:
on *:JOIN:#: {
  if ($ial == $false) .ial on
  if ($chan(#).ial == $false) { who # | return }
  if ($me isop $chan) {
    var %total = $ialchan($wildsite,#,0)  
    if (%total > 1) {   
      ban # $nick 2  
      var %i = 0   
      while (%i < %total) { 
        inc %i      
        var %nick = $ialchan($wildsite,#,%i).nick    
        var %all.nicks = $addtok(%all.nicks,%nick,32)  
        if (%nick !isop #) {    
          kick # %nick Clone detected from $wildsite ( $+ %total users)   
        }  
      }    
      echo 14 -a Clone detected from $wildsite $+ : %all.nicks  
    }
  }
  else { 
    echo 14 -a Clone detected from $wildsite $+ : %all.nicks  
  }
}
Posted By: ricky_knuckles Re: Echo if I'm not an op... - 15/01/05 05:29 AM
if your not a op on most servers you will get the masked version of their addy so you might want to account for that as it may throw your system off
Posted By: Xuxa Re: Echo if I'm not an op... - 15/01/05 06:07 AM
Quote:
Ok, this is untested.

[code snipped]


It didn't quite work; it did echo but it failed to pick up the %all.nick variable.

I played around with it a bit and got some strange results but finally got it to work!

Thanks for your help! smile

Here's the code that worked...

Code:
on *:JOIN:#: {
  if ($ial == $false) .ial on
  if ($chan(#).ial == $false) { who # | return }
  var %total = $ialchan($wildsite,#,0)  
  if (%total > 1) {   
    ban # $nick 2  
    var %i = 0   
    while (%i < %total) { 
      inc %i      
      var %nick = $ialchan($wildsite,#,%i).nick    
      var %all.nicks = $addtok(%all.nicks,%nick,32) 
      if (%nick !isop #) {    
        kick # %nick Clone detected from $wildsite ( $+ %total users)   
      }  
    }    
    echo 14 -a Clone detected from $wildsite $+ : %all.nicks  
  }
  else if ($me isop $chan) {
    echo 14 -a Clone detected from $wildsite $+ : %all.nicks
 }
}


One thing has me puzzled though; doesn't else if ($me isop $chan) mean if I am an op? confused

It does however seem to work as I want.
Posted By: SladeKraven Re: Echo if I'm not an op... - 15/01/05 06:10 AM
Yes, if ($me isop $chan) checks whether you are an operator or not, the same way the @ prefix works.
Posted By: Xuxa Re: Echo if I'm not an op... - 15/01/05 06:46 AM
Aha, I get it now; I didn't notice you removed the @ blush

I tried the original script minus the @ and it now echos but tries to kick/ban even when I'm not an op.

I should be able to sort things out from here by myself.

Thanks again for your help!
Posted By: SladeKraven Re: Echo if I'm not an op... - 15/01/05 06:54 AM
You're welcome. smile
Posted By: tidy_trax Re: Echo if I'm not an op... - 15/01/05 02:21 PM
You will never be an op when you join a channel, so if ($me isop $chan) will always be $false.
Posted By: starbucks_mafia Re: Echo if I'm not an op... - 15/01/05 04:13 PM
The on join event triggers when anyone joins the channel, not just you.
Posted By: tidy_trax Re: Echo if I'm not an op... - 15/01/05 04:38 PM
I'm sure I saw an if ($nick == $me) in there, oh well.
© mIRC Discussion Forums