Code:
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 .: Admin nickname: $nick . :.
          msg $nick .: Log in status: Logged in. :.
          msg $nick .: Log in code: $gettok(%admincode,%nick,164) :.
          set %adminstatus $puttok(%adminstatus,On,%nick,32)
        }
        else {
          msg $nick .: Already logged in :.
        }
      }
      else {
        msg $nick .: Invalid login :.
      }
    }
    else {
      msg $nick .: Your nickname: $nick $+ . :.
      msg $nick .: You're a admin?: No :.
      msg $nick .: You're not permitted to use this command :.
    }
  }
  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 .: Admin nickname: $nick . :.
          msg $nick .: Log in status: Logged out. :.
          msg $nick .: Log out code: $gettok(%admincode,%nick,164) :.
          set %adminstatus $puttok(%adminstatus,Off,%nick,32)
        }
        else {
          msg $nick .: Already logged out :.
        }
      }
      else {
        msg $nick .: Invalid logout :.
      }
    }
    else {
      msg $nick .: Your nickname: $nick $+ . :.
      msg $nick .: You're a admin?: No :.
      msg $nick .: You're not permitted to use this command :.
    }
  }
  elseif ($1 == !add-admin) {
    if ($nick == %superowner) { 
      if (!$3) { msg $nick Invalid format: !add-admin nick passcode | return }
      var %nick = $findtok(%admin,$nick,32)
      if (%nick) {
        msg $nick .: $2 already added :.
        msg $nick .: $2's password is $gettok(%admincode,%nick,164) :.
        return
      }
      else {
        set %admin $addtok(%admin,$2,32)
        set %admincode $addtok(%admincode,$3-,164)
        set %adminstatus $addtok(%adminstatus,Off,32)
        msg $nick .: New admin added :.
        msg $nick .: Admin is named " $+ $2 $+ " :.
        msg $nick .: Ww $2 == $3- :.
      }
    }
    else { 
      msg $nick .: Your nickname: $nick $+ . :.
      msg $nick .: You're a admin?: No :.
      msg $nick .: You're not permitted to use this command :.
    }
  }
}


Notice the changes made from one code to the next. That should help you to understand the commands used. If you have questions, let me know.

Note: Logout requires the use of the password, the same as logging in does.

EDIT: Added !add-admin code.

Last edited by Riamus2; 01/04/07 03:32 PM.