|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Hello all, I'm looking for a timer mechanism, that will check someone's nick when he joins a channel. If his nickname is approved, the script halts. If the nick is not approved (for example the nick is a reserved nick in a list) the user gets 5 minutes to change his nick. 0 sec delay: Warning, you need to change your nick. 150 sec delay: This is your 2nd and last warning. Change your nick now. 300 sec delay: Time's up... followed by a kick command I'm not looking for a fixed script, just an example of how to apply such a 5 minute response time. Thanks in advance
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
You could.. use timers..
When a user joins, start the timers you listed. If the users do what you require, you can stop the timer(s).
-genius_at_work
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
It's actually meant to be a hostmask checker. Rather found a solution using an example, but here is what I have:
alias hostmask.enforce.chan return #chan1,#chan2
on *:JOIN:#:{
if ($nick != $me) && ($istok($hostmask.enforce.chan,$chan,44)) {
hostmask-check $nick $chan
}
}
alias hostmask-check {
var %mask = $address($1,2)
if (*!*@*.users.ircserver.org iswm %mask) {
echo -st 07 $+ $1 05(07 $+ %mask $+ 05) has joined07 $2 05- Hostmask approved.
echo -s -
}
else {
.msg $nick 04*** WARNING $nick *** 05Your current hostmask is not allowed in $chan $+ .
.msg $nick 05You have 5 minutes to solve the problem.
}
} In that last else statement, I want to include a second warning, and an eventual kick. Unless they complied obviously, and then drop the 2nd warning, or kick. Any idea's?
|
|
|
|
Joined: Aug 2003
Posts: 144
Vogon poet
|
Vogon poet
Joined: Aug 2003
Posts: 144 |
Hi
You can start 2 timers at the same time, and you can put the commands that you want to make after them finish.
.TimerJCWarning $+ $nick 1 150 msg $chan $nick This is your 2nd and last warning. Change your nick now. .TimerJCKick $+ $nick 1 300 kick $chan $nick Message
Them you need to use the event on nick to check if the nick change his nick. And if he had, them you can halt the timers/timer
.timerJC* off
Like
on *:NICK: { ;if the exists if ( $timer( $+( JcKick, $nick)) != $null ) { ;Stop all timers off that nick $+( .Timer, JC, *, $nick) off } }
if the timer´s are not halted it´s becouse the nick have not change her nick. If he changes the mirc will detect that the timers belong to him and halt them.
Last edited by Miguel_A; 18/02/08 01:44 AM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
You don't even have the 5 min timer in there... just a message about it. What you want to do is use named timers and start them at the beginning.
on *:join:#: {
if ($nick == whatever) {
msg $nick Change your nick.
.timerLastWarn. $+ $nick 1 150 msg $nick Change your nick. Last warning.
.timerKick. $+ $nick 1 300 kick $chan $nick Time is up.
}
}
on *:nick: {
if ($timer(LastWarn. $+ $nick)) { .timerLastWarn. $+ $nick off }
if ($timer(Kick. $+ $nick)) { .timerKick. $+ $nick off }
if ($newnick == whatever) {
msg $newnick Change your nick.
.timerLastWarn. $+ $newnick 1 150 msg $newnick Change your nick. Last warning.
.timerKick. $+ $newnick 1 300 kick $chan $newnick Time is up.
}
}
on *:part:#: {
if ($timer(LastWarn. $+ $nick)) { .timerLastWarn. $+ $nick off }
if ($timer(Kick. $+ $nick)) { .timerKick. $+ $nick off }
}
on *:quit: {
if ($timer(LastWarn. $+ $nick)) { .timerLastWarn. $+ $nick off }
if ($timer(Kick. $+ $nick)) { .timerKick. $+ $nick off }
}
Now, obviously, you can put some of this into an alias to save lines and you can change your IF check to whatever method you want for storing/checking the "locked" nicks. For example, using $istok. I just used the basic check to give you an idea. I'm sure you can adjust it to work with $istok or whatever method you prefer.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Aug 2003
Posts: 144
Vogon poet
|
Vogon poet
Joined: Aug 2003
Posts: 144 |
Hi Well i have all timers necessary, but you have made a complet script. Off course that is bether... The only think that i haven´t remember was the on quit and/or on part event...
Last edited by Miguel_A; 18/02/08 01:38 AM.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
Not trying to bash your script.. just some constructive criticism.. Instead of .timerKick $+ $nick I would have used something like this: .timer. $+ $nick $+ .kick or $+(.timer.,$nick,.kick) So I could do this: .timer. $+ $nick $+ .* off or $+(.timer.,$nick,.*) off Which lets you start as many warning/kick timers as you want, and eliminates the need to add corresponding .timer off lines. Since I'm here, I'll post my code:
alias badnick {
;$1=nick
;Return 1 if nick is not allowed.
if ($1 == bob) return 1
;The below line should be last
return 0
}
on *:JOIN:#:checkit $nick 0
on *:NICK:checkit $newnick $nick
on *:QUIT:checkit 0 $nick
on *:PART:#:checkit 0 $nick
on *:KICK:#:checkit 0 $knick
alias checkit {
;$1=addnick, $2=delnick
if (($1 != 0) && ($badnick($1))) {
$+(.timer.,$1,.Join) 1 5 msg $1 Change your nickname, please.
$+(.timer.,$1,.Warn) 1 150 msg $1 Change your nickname. Final Warning.
$+(.timer.,$1,.Kick) 1 300 ban -k $chan $1 9 Restricted nickname.
}
if ($2 != 0) $+(.timer.,$2,.*) off
}
-genius_at_work
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Excellent guys. This was my problem: $+(.timer.,$nick,.*) off
With this its solved.
Thank you for the input.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Well, like I said, it was just a quick example to show how it could be done. I could have thrown in aliases, made better comparisons of the nicks, etc. I chose to show the main issue of how to handle the timers and left the rest open for him since he wasn't really looking for an entire script.
That said, thank you for the suggestions. Using wildcards does make it easier to control the timers.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Aug 2003
Posts: 144
Vogon poet
|
Vogon poet
Joined: Aug 2003
Posts: 144 |
Hi
This was my problem: $+(.timer.,$nick,.*) off
Well on mine smal example i have added a JC becouse i don´t know if you have any more scripts that can use timer´s. If you have and if they use $nick to, they can stop as well. That was the reason that i have put JC like ( JoinScript )... All the JC timers will belong to that particular script.
|
|
|
|
|