mIRC Home    About    Download    Register    News    Help

Print Thread
#163383 29/10/06 10:30 AM
Joined: Feb 2006
Posts: 307
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
hello

how can I prevent the below script to msg the same person two or more times in 5 seconds?

Code:
 on !1:join:#: if ($nick isreg $chan) { .timer 1 5 /msg $nick welcome to our channel! } }
  


thanks!

#163384 29/10/06 11:03 AM
Joined: Oct 2006
Posts: 15
S
syr Offline
Pikka bird
Offline
Pikka bird
S
Joined: Oct 2006
Posts: 15
try this
on !1:join:#: if ($nick isreg $chan) && ( $nick != %welcomed ) { set %welcomed $nick | .timer 1 5 /msg $nick welcome to our channel! } }

#163385 29/10/06 02:32 PM
Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
I haven't tried any of these codes, but, from memory, should you put 'set -u5 %welcomed $nick', also, you have an extra bracket, if the above script doesn't work, try this:
Code:
on !1:join:#: {
  if ($nick isreg $chan) && ($nick != %welcomed) { 
    set -u5 %welcomed $nick | .timer 1 5 msg $nick welcome to our channel! 
  } 
} 


-Kurdish_Assass1n
#163386 29/10/06 06:18 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
One small point: the ($nick isreg $chan) is useless in an ON JOIN event, since all nicks are regular users at the time of joining, so that condition will always come back as True.

Here's my recommendation:
Code:
on !*:join:#:{
if !$istok(%welcomed,$nick,32) {
.msg $nick Welcome to our channel
}
set %welcomed $addtok(%welcomed,$nick,32)
.timer 1 5 set %welcomed $remtok(%welcomed,$nick,1,32)
}
  

The main difference here, is that if you get a lot of people joining quickly, this would still prevent someone joining/leaving/re-joining within the 5 second time period.

#163387 29/10/06 06:28 PM
Joined: Jul 2006
Posts: 242
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
ON !*:JOIN:#: {
IF (%joincheck. [ $+ [ $wildsite ] ] == $null) {
.timer 1 2 joincheck $nick $chan
SET -u7 %joincheck. [ $+ [ $wildsite ] ] 1
}
}
alias joincheck {
if ($1 isreg $2) {
.msg $1 Welcome to our channel.
}
}


Newbie
#163388 29/10/06 08:32 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
on !1:join:#: .timer [ $+ [ $chan ] $+ [ $wildwite ] ] 1 5 /msg $nick welcome to our channel! }


-KingTomato

Link Copied to Clipboard