Code:
alias i {
  if ($1) {
    if (#$2 ischan) { invite $1 #$2 }
    elseif ($2) { echo -a invite: Cannot invite $1 on $2 - You're not on that channel. }
    elseif ($active ischan) { invite $1 $active }
    else { echo -a invite: Neither is $active a channel; nor did you provide a channel to invite $1 }
  }
  else { echo -a invite: No nick given. Syntax: /i <nick> or /i <nick> <chan> }
}


for your secure alias, I think it's ok... Maybe add a check for "being op on that chan".
As a note, you don't need to prefix commands in scripts with a / ...You need them only if you want to set a command per editbox smile

Hm, I'm confused what the /aop alias shall do in detail confused