Quick reply, much appreciated.
![smile smile](/images/graemlins/mirc/smile.gif)
After reading over some of the changes you've made, I noticed something:
In the elseif statement, you added
| inc %login.counter which would put the counter to 1, decreasing the attempts possible down to 4.
The tip on
inc %var is greatly appreciated, that should shorten up some of my other code nicely, thanks
![laugh laugh](/images/graemlins/mirc/laugh.gif)
For my application, the message telling them time remaining isn't necessary, since it's allowing root access to the computer and, if they're messing up more than 5 times, it's because they're not supposed to be there. But, I'm sure it could come in handy if someone were to apply this elsewhere.
Edit:
I added an alias so the login function could be applied to various scripts in your remote by adding the line:
I also added a few more features like: automatic logout on certain events, a specific logout function, various changes to shorten up the code.
alias ismaster {
if (%master.ident.ip.host == $address($1,5)) {
return true
}
return false
}
on *:notice:login *:?: {
if (%login.counter <= 4) {
if ($2 == Password) {
unset %login.counter
set %master.ident.ip.host $address($nick,5)
notice $nick Password Accepted
}
else {
inc %login.counter
notice $nick Password Incorrect
echo -a $nick %login.counter
}
}
else {
notice $nick You have failed 5 login attempts, please wait 5 minutes before trying again.
.timer 300 1 set %login.counter 0
}
}
on *:nick: {
if (%master.ident.ip.host == $address($nick,5)) {
set %login.counter 0
unset %master.ident.ip.host
notice $newnick You have been logged out.
}
}
on *:notice:logout:?: {
if (%master.ident.ip.host == $address($nick,5)) {
set %login.counter 0
unset %master.ident.ip.host
notice $nick You have been logged out.
}
}
on *:notice:*:?: {
if ($address($nick,5) == %master.ident.ip.host) {
echo -a Processing
$1-
}
}