mIRC Homepage
Posted By: CyborAccess password script - 01/02/05 08:12 PM
hi,i wana make a password script and i have no idea how,but i do no what it's like
this is what its like:
when someone join the channel,the bot ask the user the password,if they answer the password right they get to stay on then channel,if they're wrong they'r kicked,and if they dont answer the bot,they get to say 3 thing before the bot kick em,and i also like a script that changeds the password,
so anyone have an idea,cuz i need it,thanks
Posted By: argv0 Re: password script - 01/02/05 09:00 PM
type /set %p_chan #YOUR_CHANNEL_NAME
and /set %p_pass YOURPASSWORD
and then add the following code block to your remotes (alt-r).

The user has to type /notice YOURBOTNAME pass PASSWORD

Your 'password changing script' is simply:
/set %p_pass NEWPASSWORD

or you can make some simple alias like
alias newpass { set %p_pass $$1 }

Code:
ON @*:JOIN:%p_chan: { 
  .notice $nick Please type /notice $me pass PASSWORD to stay on this channel, or you will be removed.
  .set %pass. [ $+ [ $nick ] ] 3
}

ON @*:TEXT:#YOURCHANNEL: {
  if (%pass. [ $+ [ $nick ] ]) {
    dec %pass. $+ $nick
    if (%pass. [ $+ [ $nick ] ] == 0) {
      p_remove $nick $fulladdress
    }
  }
}

ON ^*:NOTICE:pass *:?: {
  if (%pass. [ $+ [ $nick ] ] && $nick ison %p_chan) {
    if ($2 != %p_pass) {
      .notice $nick Incorrect password, removing you from %p_chan
      p_remove $nick $fulladdress     
    }
    else {
      .notice $nick Correct password, thank you.
      unset %pass. $+ $nick
    }
  }
  haltdef
}

alias -l p_remove {
  mode %p_chan -ob $$1 $mask($$2,3)
  kick %p_chan $$1 You are not allowed in this channel
  unset %pass. $+ $$1
}
Posted By: CyborAccess Re: password script - 01/02/05 09:33 PM
i tryed it,it doenst work and its so confusing confused
Posted By: ricky_knuckles Re: password script - 01/02/05 11:40 PM
ive got a version in my bot
but the way it works is if you type the password which is the content of %x it add whatever follows to the user list
i dont know if it will help but here u go
i keep this for if im ever abroad
Code:
 
#remoteaccess on
on *:text:!ruser *:*:{
  if ($ulevel >= 4) { 
    ruser $$2 
    closemsg $nick  
  }
}
 [color:red]on *:text:!pass *:*:{ 
  if ($ulevel >= 4) { 
    unset -s %x 
    set -s %x $$2-  
    closemsg $nick  
  }
} 
on *:text:*:*:{
  if ($1 = %x) { 
    auser $$2- 
    closemsg $nick  
  } 
}
[/color]#remoteaccess end
 

you can easily modify this so that it sets a user level dor them useing $address
then just make the function you want them to be able to access available to that level
Posted By: ricky_knuckles Re: password script - 02/02/05 12:17 AM
i threw this together but it doesnt work which is interesting
Code:
  
alias /pass {
  set %x $$1
}
on @*:join:#:{
  msg $nick enter the pass please.
  timer $+ $nick 1 20 kick $chan $nick
closemsg $nick
}
on @*:text:!pass *:?:{
  if ($$2- = %x) { 
    timer $+ $nick off
    closemsg $nick  
  } 
}
Posted By: nycdiesel Re: password script - 02/02/05 12:28 AM
Code:
; channel lockout

ON !*:JOIN:#channelname:{
  .notice $nick You must type /notice $me PASS <password> to stay in this $&
    channel. If you dont respond you have the ability to say three lines until $&
    you are forced out of this channel. Thank you.
  if (!$evalnext($+(%,keepout.,$site))) {
    set $+(%,keepout.,$site) 3
  }
}

ON @*:TEXT:*:#channelname:{
  if ($nick ison $chan) {
    if ($evalnext($+(%,keepout.,$site))) {
      if ($evalnext($+(%,keepout.,$site)) <= 3) { dec %keepout. [ $+ [ $site ] ] }
      if ($evalnext($+(%,keepout.,$site)) <= 0) {
        ban -u120 # $nick 3
        kick # $nick You've been warned and havent identified to me in which you are $&
          now not welcome here. [2min ban]
        unset %keepout. [ $+ [ $site ] ]
      }
    }
  }
}

ON !*:NOTICE:pass *:?:{
  if ($2 == %keepoutPASS) {
    if ($evalnext($+(%,keepout.,$site))) {
      .notice $nick Password accepted!
      unset %keepout. [ $+ [ $site ] ]
    }
  }
  elseif ($2 != %keepoutPASS) { .notice $nick Password incorrect. }
}


You have to set %keepoutPASS to the password you want.
Also I'm using $site just for protection from people who want to change their nicknames and attempt to avoid the script. This method isnt completely secure due to the fact that some irc server software like UnrealIRCD prefixes users host upon connecting. Then the user can simply change the mode +x to -x meaning their hostmask wont be prefixed anymore.
Posted By: tidy_trax Re: password script - 02/02/05 12:43 AM
The reason it doesn't work is because of the @ part of your on @*:text:!pass *:?: event, it's not possible to be an operator in a query so the event will never be triggered while the @ is there.
Posted By: ricky_knuckles Re: password script - 02/02/05 01:55 AM
thanks
Posted By: Gremel Re: password script - 03/02/05 12:45 AM
Nevermind, figured it out smile
Posted By: CyborAccess Re: password script - 03/02/05 06:13 PM
ya...but how do i change the password and stuff?
i just want a simple password script that do what i desribed...
Posted By: Gremel Re: password script - 03/02/05 10:12 PM
When ever you wish to change the password, just change the $keepoutPASS to your password.

ie)

$keepoutPASS changed to GREMEL
Posted By: DaveC Re: password script - 03/02/05 11:30 PM
Quote:
When ever you wish to change the password, just change the $keepoutPASS to your password.

ie)

$keepoutPASS changed to GREMEL


^ ummm u mean %keepoutPASS, there is no alias by that name.
Posted By: Gremel Re: password script - 06/02/05 06:24 AM
oops, not used to typing % frown
© mIRC Discussion Forums