Code:
on *:text:*:#mychan: {
  if !latest == $1 {
    if $nick isop #mychan {
      if .add == $2 {
        .write latest.txt $3- $ctime
        halt
      }
      alias -l playlatest {
        inc %latest.cnt
        notice $nick %latest.cnt $+ $chr(41) $gettok($2-,1- $calc($gettok($2-,0,32) - 1),32) $duration($calc($ctime - $gettok($2-,0,32)))
        if (%latest.cnt >= $lines(latest.txt)) { unset %latest.cnt }
      }
      .play -a playlatest $nick latest.txt 1500
    }
  }


With the code tags and some proper indentation you can (I hope) see where the problem is.... (note that the braces don't match up)

I also don't see anywhere where you actually call the alias (that you haven't actually created...<hint>) playlatest...