on *:text:*:?: {
if ($1 == .login) {
var %nick = $findtok(%admin,$nick,32)
if (%nick) {
if ($gettok(%admincode,%nick,164) == $2-) {
if ($gettok(%adminstatus,%nick,32) == Off) {
msg $nick LOGIN: You are now logged in as $nick $+ .
set %adminstatus $puttok(%adminstatus,On,%nick,32)
}
else {
msg $nick LOGIN: You are already logged in.
}
}
else {
msg $nick LOGIN: Invalid password or nickname (your current nickname).
}
}
else {
msg $nick LOGIN: You aren't an admin or user.
}
}
elseif ($1 == .logout) {
var %nick = $findtok(%admin,$nick,32)
if (%nick) {
if ($gettok(%admincode,%nick,164) == $2-) {
if ($gettok(%adminstatus,%nick,32) == On) {
msg $nick LOGOUT: You are now logged out.
set %adminstatus $puttok(%adminstatus,Off,%nick,32)
}
else {
msg $nick LOGOUT: You aren't logged in.
}
}
else {
msg $nick LOGOUT: Invaled password or nickname (your current nickname)
}
}
else {
msg $nick LOGOUT: You aren't an admin or user.
}
}
elseif ($1 == .add-admin) {
if ($nick == %owner || $nick == %secondowner) {
if (!$3) { msg $nick ADD: Invalid format: .add-admin nick passcode | return }
var %nick = $findtok(%admin,$2,32)
if (%nick) {
msg $nick ADD: $2 is already added.
msg $nick ADD: $2's password is $gettok(%admincode,%nick,164) $+ .
return
}
else {
set %admin $instok(%admin,$2,0,32)
set %admincode $instok(%admincode,$3-,0,164)
set %adminstatus $instok(%adminstatus,Off,0,32)
msg $nick ADD: New admin named " $+ $2 $+ ".
msg $nick ADD: Password of $2 is $3- $+ .
}
}
else {
msg $nick ADD: You aren't my owner, or otherwise you aren't an admin or user
}
}