mIRC Homepage
Posted By: aZnLupin Kick All Clones - 05/03/03 07:30 AM
Need script like kick all clones if user same ip together, can you help me ?
Posted By: theRat Re: Kick All Clones - 05/03/03 07:34 AM
Code:
alias clonekick {
  if ( $1 ) {
    var %i = 1
    while ( $gettok($ialchan($address($1,2),#,%i),1,33) ) {
      kick # $ifmatch $2-
      inc %i
    }
  }
}


Use: /clonekick <nick>
Kicks all the users on channel with same host as <nick>
Posted By: Knappen Re: Kick All Clones - 05/03/03 07:36 AM
mode $chan +b $wildsite
Posted By: aZnLupin Re: Kick All Clones - 05/03/03 08:02 AM
Thanks for help
Posted By: Hammer Re: Kick All Clones - 05/03/03 08:17 AM
$wildsite will be $null if you're not in an event that fills that identifier with data.

In order to save your loop from having to resolve the address mask each time through the loop, it would be better to use a variable to hold that data.
Code:

alias clonekick {
 
  var %reason = -CloneKick-                    | ; Kick reason template
                                               | ;  
  if #* iswm $1 &amp;&amp; $2 ison $1 {                | ; /clonekick #Channel CloneNick blah blah
    var %chan = $1                             | ;     %chan   = #Channel
    var %nick = $2                             | ;     %nick   = CloneNick
    %reason = %reason $3-                      | ;     %reason = (-CloneKick- blah blah)
  }                                            | ; 
  elseif $1 ison $active {                     | ; /clonekick CloneNick Begone, schizophrenic!
    var %chan = $active                        | ;     %chan   = active window
    var %nick = $1                             | ;     %nick   = CloneNick
    %reason = %reason $2-                      | ;     %reason = (-CloneKick- Begone, schizophrenic!)
  }                                            | ;  
  else return                                  | ; If no matching condition, halt
                                               | ;  
  var %wildsite = $address(%nick, 2)           | ; *!*@host.domain
  var %i = 1                                   | ; Loop index
                                               | ;  
  while $ialchan(%wildsite, %chan, %i).nick {  | ; While there are more clones
    kick %chan $ifmatch %reason                | ;     kick a clone
    inc %i                                     | ;     move on to the next one
  }
}

/clonekick #mIRC clonenick1 blah blah blah4
/clonekick clonenick1 Begone, you schizophrenic escapee!
Posted By: aZnLupin Re: Kick All Clones - 05/03/03 08:26 AM
All that i need wink
Posted By: aZnLupin Re: Kick All Clones - 05/03/03 08:52 AM
If me is in clones nick, how can i except me in clones list ?
Posted By: Online Re: Kick All Clones - 05/03/03 11:40 AM
Replace this line -
Code:

kick %chan $ifmatch %reason

With:
Code:

if ($ifmatch isop %chan) { kick %chan $ifmatch %reason }
Posted By: Aubs Re: Kick All Clones - 05/03/03 01:07 PM
Your example wouldn't work Hammer, simply because:

/clonekick CloneNick Begone, schizophrenic!

elseif $1 ison $active {

but $1 = Begone,

and if Begone is a nick, then he/she will not be targeted if you use the " , "

(Think I'm right!)

smirk
Posted By: qwerty Re: Kick All Clones - 05/03/03 02:04 PM
First of all, I really like the way you comment your script with | ;comment, it looks very good. The fact that you didn't use ( ) brackets in your /if statements makes it even prettier too wink


if #* iswm $1 && $2 ison $1

Wouldn't a "if $2 ison $1" be enough? It can never be true if $1 isn't a channel. Furthermore, it wouldn't work on &channels (or any other type of channels supported by the server), although this would be a very rare occasion. You could overdo it by having something like "if $left($1,1) isin $chantypes" but I think just omitting the 1st condition is enough smile

You might wanna throw an "if $me !isop %chan" check in there too (right after "else return"), although somebody could have a higher mode (not @ - op) that would allow him to kick people, in which case you would probably need a
"if $nick(%chan,$me,$left($prefix,$pos($prefix,@)))"
but that's a bit far-fetched too :tongue:
Posted By: Aubs Re: Kick All Clones - 05/03/03 05:20 PM
&Channels are modeless - doesn't that mean you can't kick anyone?
Posted By: qwerty Re: Kick All Clones - 05/03/03 05:48 PM
&channels aren't modeless. Read section 1.3 of the IRC RFC, you'll see they are channels local to the server.

In any way, &channels was just an example, there are ircds that allow other channel prefixes and at least some of those are not modeless.
Posted By: Hammer Re: Kick All Clones - 06/03/03 08:00 AM
Aubs:
/clonekick CloneNick Begone, schizophrenic!

%chan == $active (not specified)
%nick == CloneNick ($1)
%reason == -CloneKick- Begone, schizophrenic! ($2-)

and if Begone is a nick, then he/she will not be targeted if you use the " , "

If Begone is the nick you are trying to kick, then the command would be /clonekick Begone Begon, schizophrenic!

#channel - normal channel
&channel - local channel (on $server only)
+channel - modeless channel

qwerty:
Wouldn't a "if $2 ison $1" be enough?

Yup, it certainly would be enough. I removed it from the elseif (condition) but forgot to remove it from the if (condition).

"if $me !isop %chan" <snip /> although somebody could have a higher mode (not @ - op) that would allow him to kick people

That's why I omitted that particular check + return. With new op-type modes/statuses coming out fairly regularly, I figured that the best way to deal with that is to simply let them get the error messages from the server if there is a problem and then let them correct the problem. cool

Posted By: Aubs Re: Kick All Clones - 06/03/03 01:20 PM
Yep, apologies Hammer... /me should have looked more closely!!

Sorry smile
Posted By: Dr4g0n Re: Kick All Clones - 16/07/03 01:41 PM
Cant it be doen some easier?
© mIRC Discussion Forums