mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 18
G
Gwion Offline OP
Pikka bird
OP Offline
Pikka bird
G
Joined: Dec 2002
Posts: 18
Hi,

I have been playing around with this but can't get it to work properly. So, I need your help. smile
Purpose is: when someone joins the channel and has guest (=gast) in the nick (e.g. gast1235) he should get a message which gives some info how to change the nick. After a while the script should check if he changed the nick. If there is still gast in the nick he should be kicked. If he changed and has no longer gast in it nothing should happen.
This is the script:

on *:JOIN:#mytest:{
if (($nick != $me) && ($nick !isop $chan)) {
/timermsg. [ $+ [ $nick ] ] 1 15 /nickmsg $nick $chan
/timermsg2. [ $+ [ $nick ] ] 1 30 /nickmsg2 $nick $chan
}
}
alias nickmsg {
if ((gast isin $1) && ($1 ison $2)) {
/notice $1 Hallo
}
}
alias nickmsg2 {
if ((gast isin $1) && ($1 ison $2)) {
/kick $2 $1 bleh
}
}

The times (15 and 30 sec) are just for testing purpose and will later be 120 and 180.
What the script does not now, is to check if the person has changed the nick. If the person gets the message and then change to e.g. Gastxyz nothing happens.
However if he doesn't change his nick the kick works. So it must be a problem with $1 .. what am I doing wrong?

Thanks
Gwion

Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
on *:nick: if ( $timer($+(msg2.,$nick)) ) .timer $+ $nick off


Code:
//if ( khaled isgod ) echo yes | else echo no
Joined: Jan 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
use if (Gast* iswm $nick)

Joined: Dec 2002
Posts: 117
R
Vogon poet
Offline
Vogon poet
R
Joined: Dec 2002
Posts: 117
The problem is that the nick is no longer on the channel, something like this happens:

gast123 joins #mytest
/timermsg.gast123 is started: in 15 seconds it will execute /nickmsg gast123 #mytest
/timermsg2.gast123 is started as well
gast123 changes nick to gast456
/timermsg.gast123 executes /nickmsg gast123 #mytest
/nickmsg sees that gast123 is no longer in #mytest so it does nothing

Same happens for /nickmsg2
The solution is to check for nick changes as well:
Code:
;your code

on !*:NICK:{
  timermsg. [ $+ [ $nick ] ] off
  timermsg2. [ $+ [ $nick ] ] off
  if ((gast* iswm $newnick) && ($newnick ison #mytest)) {
    timermsg. [ $+ [ $newnick ] ] 1 15 nickmsg $newnick $chan
    timermsg2. [ $+ [ $newnick ] ] 1 30 nickmsg2 $newnick $chan
  }
}

Also, the way you avoid operators won't work: When they join they won't be opped, so there's no need to check for ops. If they don't change their nick but get opped, /nickmsg2 will still kick them, so you should check for isop there.
Also, you can use the ! prefix in the on join: on !*:join:mytest: This prevents it from triggering when you join yourself, so you don't need the if statement there at all.



$input(Me like stars, You too?)

Link Copied to Clipboard