mIRC Homepage
Posted By: state any one see anything wrong here - 18/07/06 08:07 PM
all i get is

9:06p • •$1$3join: trev (*****)
9:06p (@^) Welcome trev, This is a private channel. Please enter the password or you will be kicked (10seconds)
9:06p (trev) password liam

Code:
on @*:join:#fukliam: { 
  set -u10 %timerpswrd ON
  set %psswrdnick $nick
  set %psswrdchan $chan
  msg # Welcome $nick $+ , This is a private channel. Please enter the password or you will be kicked (10seconds)
  .timerpsswrd 0 1 psswrdkick
}


on @*:TEXT:password *:#fukliam: { 
  if ($2 == liam) {
    if ($timer(psswrd)) { .timerpsswrd off }
    set %timerpswrd OFF
    .notice $nick Password Accepted.
  }
}

alias psswrdkick {
  if (!%timerpswrd) {
    ban -k %psswrdchan %psswrdnick 5 Removed.
    if ($timer(psswrd)) { .timerpsswrd off }
    .timerban 1 3 mode %psswrdchan -b $address(%psswrdnick,5)
  }
}

on *:NICK:{
  if (($($+(%,password.not.entered.by.,$nick),2)) && ($newnick ison #fukliam)) {
    .notice $newnick Mahahahahahaha trying to evade!
    ban -k #fukliam $newnick 5 Removed.
    .timerban 1 3 mode #fukliam -b $address($newnick,5)
    unset $+(%,password.not.entered.by.,$nick)
  }
}
Posted By: KingTomato Re: any one see anything wrong here - 18/07/06 08:50 PM
I found no problem with the script, worked as intended. My only tiff (if you could call it that) would be if multiple people joined the server at once, the late-comer would get less time, and would 'bail' the previous joiner out. I.e. if player1 joined the channel and received the notice to enter the password, then player2 joined and received the same notice, player1 would no longer be the victim of a kick for an inappropriate password, and player2 would only have x seconds (where x is 10 - the time between player1 and player2's joins).

Anyways, I tried my hand at it, did a little improving, and this is what I got. If you have any questions, or would like to know why I chose the methods I did, just ask. I'll be happy to answer any questions.

*tested*
Code:
on @*:JOIN:#fukliam: {
  var %timer = $+($chan,$chr(44),$nick)
  .timer [ $+ [ %timer ] ] 1 10 /password_kick $chan $address($nick,5)
  /msg $chan Welcome $nick $+ , This is a private channel. Please enter the password or you will be kicked (10 seconds)
}

on @*:TEXT:password *:#: {
  var %pass = liam

  if ($2- == %pass) {
    var %timer = $+($chan,$chr(44),$nick)
    if ($timer(%timer)) .timer [ $+ [ %timer ] ] off
    /notice $nick Password accepted.
  }
}

on *:NICK: {
  var %chan = #fukliam, %timer = $+(%chan,$chr(44),$nick), %kick = $false
  if ($timer(%timer) && ($newnick ison %chan)) {
    ; if you want to kcik on a namechange, that's fine, or you can carry the timer over.
    if (%kick) { | ; kick on name change (change the %kick above to disable)
      .notice $newnick Mahahahahahaha trying to evade!
      /password_kick %chan $newnick
    }
    else {   | ; timer carry over
      var %newtimer = $+(%chan,$chr(44),$newnick)
      .timer [ $+ [ %newtimer ] ] 1 $timer(%timer).secs $replace($timer(%timer).com,$nick,$newnick)
      .timer [ $+ [ %timer ] ] off
      .notice $newnick Your name change has no effect on the privacy of this channel.
    }
  }
}

alias password_kick {
  var %chan = $1, %address = $2, %nick = $gettok(%address,1,33), %timer = $+(%chan,$chr(44),%nick)

  if ($timer(%timer)) .timer [ $+ [ %timer ] ] off

  /ban -ku3 %chan %nick 2 Removed.
}
Posted By: RusselB Re: any one see anything wrong here - 18/07/06 09:13 PM
Here's a re-write of your code that simplifies the process considerably , and takes into account people joining in within the 10 second delay for the password. One suggestion that I didn't code, is to have the person that joined send the password via pm/query. I didn't code that, because you currently have it set for the channel, although once one person in the channel enters the password, anyone else in the channel will see that password...not the greatest from a security point of view.
Code:
 on @*:join:#fukliam: { 
  msg # Welcome $nick $+ , This is a private channel. Please enter the password or you will be kicked (10seconds)
  $+(.timer,$address) 1 10 ban -ku3 $chan $address
}

on @*:TEXT:password liam:#fukliam: { 
  $+(.timer,$address) off
  .notice $nick Password Accepted.
}
 


An alternative suggestion, is to use /mode #fukliam +k liam

That way they have to enter the password/key to be able to enter the channel, rather than kicking/banning them for not entering the correct password.
© mIRC Discussion Forums