Fixed the syntax. You can't have events (OnText, OnAction, and others) inside of other events.

; *// BAN LIST //*
on *:text:*!ban*:#troyl:{
  if (($nick isOP $chan)) {
    msg $chan /ban $2 $3
    set %banned = $2 

on *:text:*:#troyl:{
  if ($nick == %banned) {
    msg $chan /ban $nick You have been put on the permanent ban list on TroyBot. A manual unban can not be done. If you have a question regarding why you were banned please contact a moderator.. 
} #msl (mIRC Scripting Language)