mIRC Home    About    Download    Register    News    Help

Print Thread
#221407 16/05/10 07:20 PM
Joined: Jan 2009
Posts: 25
F
Fernin Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Jan 2009
Posts: 25
I've been trying to set up a script that'll kick a certain user when he changes his nick, but I'm not sure if it's possible, or if I'm simply getting some part of the code wrong...

Currently, I have it as:

Code:
on 1:nick: if($newnick == M3GA*) { kick $chan $newnick Message }


He changes his nick about once every 4 hours, putting the name of whatever game he's playing after M3GA, but I'm not certain if the * wildcard actually works in that way. I'm also not looking to kick everyone who changes their nicks, just that one specific person. Any advice?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
on 1:nick: if (M3GA* iswm $newnick) { kick #chan $newnick Message }


Edited for #chan as I forgot about that not being valid in on NICK.

Last edited by Riamus2; 16/05/10 07:44 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2008
Posts: 95
A
Babel fish
Offline
Babel fish
A
Joined: Dec 2008
Posts: 95
1. You can't use wildcards in comparisons like that, you're looking for the iswm operator, see /help iswm

2. You might also need a space between the if and the (.

3. In an on NICK event, you don't have a $chan because the nickchange is not channel-related, you are going to have to replace $chan by a specific channel or loop through $chan() or rather $comchan().

Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
replace "==" by "iswm"
but u can't kick from $chan bcz ON NICK event isnt a channel event but a server event
so this can be something like this
Code:
on *:nick:if (M3GA* iswm $newnick) && ($v2 ison #chan) { kick $v2 $v1 Message }

replace #chan by your channel name

P.S: this code isnt tested


WorldDMT
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Originally Posted By: Fernin
[...] putting the name of whatever game he's playing after M3GA [...]
Moreover, if you want to allow for "M3GA", use: if (M3GA?* iswm $newnick)
Without that extra wildcard you'll kick for taking the nickname "M3GA" as well. smile

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Yeah adding what Horstl stated, you should use $comchan so it works for all the channels rather than a single channel, which has to be specified:
Code:
on *:nick: {
  if (M3GA?* iswm $newnick) {
    var %x = $comchan($newnick,0)
    while (%x) {
      if (($me isop $comchan($newnick,%x)) && ($newnick ison $v2))  {
        kick $v2 $v1 Message
      }
      dec %x
    }
  }
}

Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
i think u have to ban it too bcz he can rejoin channel and check if you are half op too so

Code:
on *:nick:{
  if M3GA?* iswm $newnick {
    var %x $comchan($v2,0)
    while %x {
      if $nick($comchan($newnick,%x),$me,oh) && $newnick ison $comchan($newnick,%x) { ban -ku600 $v2 $v1 2 Message }
      dec %x
    }
  }
}


WorldDMT
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
if you want to kick him from all channels those would be fine. but if you wanted to kick him from a specific channel:
Code:
on *:NICK:{ 
  if (M3GA?* iswm $newnick) && ($newnick ison #ChannelToKickFrom) && ($me isop #ChannelToKickFrom) { 
    ban -ku3 $v2 $newnick 2 You changed your nick to something other than M3GA 
  }
}

Change "ChannelToKickFrom" to the channel name

Last edited by FroggieDaFrog; 17/05/10 01:26 AM.

I am SReject
My Stuff
Joined: Nov 2009
Posts: 81
V
Babel fish
Offline
Babel fish
V
Joined: Nov 2009
Posts: 81
oh. thats awesome idea for script.

if your irc network (services) supported kill nicks, its for you:

Code:
on *:START: {
  notify on
  notify +NICK
  notify +NICK
  notify +NICK
  notify +NICK
  notify +NICK
}
on *:NOTIFY: {
  if (+* iswm $nick) inc %::notify. [ $+ [ $cid ] $+ . $+ [ $mid($nick,2) ] ]
  else {
    inc %::notify. [ $+ [ $cid ] $+ . $+ [ $nick ] ]
    whois $nick
  }
}
on *:DISCONNECT: {
  unset %::notify. [ $+ [ $cid ] $+ ] *
}
on *:EXIT: {
  unset %::notify.*
}
raw 311:*: {
  if (%::notify. [ $+ [ $cid ] $+ . $+ [ $2 ] ]) {
    NickServ GHOST $2
    dec %::notify. [ $+ [ $cid ] $+ . $+ [ $2 ] ]
    if (%::notify. [ $+ [ $cid ] $+ . $+ [ $2 ] ] = 0) unset %::notify. [ $+ [ $cid ] $+ . $+ [ $2 ] ]
  }
}


- When any user in IRC use your nick (/nickserv links) you can kill he by /nickserv ghost.

But it works ONLY if your services support this function.
Be IRC Operator! smile

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Originally Posted By: FroggieDaFrog
if you want to kick him from all channels those would be fine. but if you wanted to kick him from a specific channel:
Froggie, you can make the script negate specific channels like so:
Code:
on *:nick:{
  var %c #chan1 #chan2 #chan3 #chan4 #chan5 #chan6 #chan7 #chan8
  if M3GA?* iswm $newnick {
    var %x $comchan($v2,0) | while %x {
      if $nick($comchan($newnick,%x),$me,oh) && $newnick ison $comchan($newnick,%x) && !$istok(%c,$comchan($newnick,%x),32) { 
        ban -ku600 $comchan($newnick,%x) $newnick 2 Message 
      }
      dec %x
    }
  }
}
Replace #chan1 #chan2...etc. with the channels you don't want the script to be triggered on. Of course, you can make it positive by removing the ! from the $istok and add the channels you want the script to work on conversely.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
I understand that. I was just showing him, that if it was just a specific channel then he didn't need to loop smile


I am SReject
My Stuff

Link Copied to Clipboard