mIRC Home    About    Download    Register    News    Help

Print Thread
I
InuYasha209
InuYasha209
I
I want to make a timer kick script, and basically for name changes.

I have the timer made... However, when the name is changed, the kick still enacts even when the name is changed.

My beta kick:

tkick:timer 1 20 /kick # $$1 $$?="Reason:"

(Popup:nicklist)

Any suggestions?

Joined: Aug 2004
Posts: 7,168
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
Code:
 menu nicklist {
tkick: timer 1 20 ban -ku # $$1 5 $$?="Reason"
}
 

Kick requires a nick, as ban will work with an address. As above, the ban command will kick the person using the address matching mask 5, and then unset immediately (equivalent of kicking them). I left the Reason option alone, and as it's coded is required, even though the actual kick/ban doesn't require a reason.

You can change the format of the address that's used by changing the 5 in the ban command to another number.

Read /help $mask for details regarding the other options available.

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Quote:
I want to make a timer kick script, and basically for name changes.


I believe his problem is that when his timer executes, if the person changed their nick (after setting the timer, but before the timer executes), the timer will be attempting to kick the former nick, instead of the new nick.

This sort of script is overall messy. And honestly, you'd be better off not using a delayed kick, it introduces too many problems, and too many checks, since there isn't an "on *:nick:#:{}" you have to perform a while loop, for each channel.

It's easier to make the script channel independent, but then the delay would only work for one channel..

Code:
alias kickit { $+(.timer.kickit.,$active,.,$$1) 1 20 kick $active $1 $$?="Message?" }
on ^*:nick:{
  var %i = 1
  while ($comchan($newnick,%i)) {
    var %channel = $v1
    if ($comchan($newnick,%i).op) { 
      var %timername = $+(.kickit.,%channel,.,$nick)
      if ($timer(%timername)) {
        var %secs = $timer(%timername).secs , %msg = $gettok($timer(%timername).com,4-,32)
        .timer $+ %timername off
        $+(.timer.kickit.,%channel,.,$newnick) 1 %secs kick %channel $newnick %msg
      }
    }
    inc %i
  }
}


Just a cheap alias I threw together, though, I'll let it be known, I rather kick someone immediately, I'm not a fan of loops.

In a channel: /kickit nick

This will kick a nick after 20 seconds, even if they change their nick.

I
InuYasha209
InuYasha209
I
No, it kicks that person...


* Timer 2 1 time(s) 20s delay /kick #roflroflroflrofl Inu change your name (IRC)
————————————————————
[4:08:38am] Inu (x_y@) is now known as Rofl
[4:08:48am] * Rofl was kicked by ED-209 (change your name)
[4:08:48am] Rofl (x_y@) has joined but is a Clone of ED-209 «2 people»

Basically what I am trying to create is a timed ban for users who join a PG Chat with an inappropraite name. Therefore asking the user to change their name, and giving them 20 seconds. If user doesn't change name, I want it to kick, if user changes to a better name, then it won't kick. I have my main kicking scripts all fine. But I'd like this timed out so it's easy.

I was hoping, if the user changed their name to something better, the computer would TRY to kick the original name it was told to kick.

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Ah. This is what you should have said in your original topic. I hate writing these sorts of scripts for other people, testing is always an annoyance.

Well, in this case,

Code:
alias badnick_kick {
  var %chan = $1 , %nick = $2
  if (%nick ison %chan) {
    ban -k %chan %nick 2 You were asked to change your nick.
  }
}


Then, when a user joins on the channel, you'll check if the nick is a bad nick, then if it is, do a .timer 1 20 badnick_kick $chan $nick.

You'll also have an "on nick" event, to check if the nick changed to another bad nick. If the user was using a bad nick, and changes to another bad nick, just kick them and get it over with.

I
InuYasha209
InuYasha209
I
doesnt seem to work... think I did it wrong?


Link Copied to Clipboard