I just missed a debugging line in the code as the person above mentioned. I can't go back and edit that post so I'll post the corrected code below so other people can copy/paste:

Code
; mIRC znc.in/self-message CAP support script by Mouse
; http://forums.mirc.com/ubbthreads.php/topics/252752
; v0.4 2021-06-04

; If server offers znc.in/self-message capability then request it.
raw CAP:*LS*znc.in/self-message*:{ .raw CAP REQ :znc.in/self-message }

; Local alias to get correct "own" action and nick colors
alias -l owncolor {
  if ($1 == action) {
    if ($color(own text) == $color(normal text)) { return $color(action text) }
    else { return $color(own text) }
  }
  if ($1 == nick && $cnick($me) > 0) {
    return $cnick($me).color
  }
}

; Process all private messages delivered to $me for which $me is not the target/recipient AND
; when no window for $me exists.
on ^*:OPEN:?:{
  if ($target != $me) {
    ; Make sure we have a query window to print to.
    if (!$window($target)) { query $target }
    ; Print message with proper formatting after checking if it's an ACTION.
    if ($gettok($rawmsg,4,32) == : $+ $chr(1) $+ ACTION) {
      echo $owncolor(action) -bfmt $+ $msgstamp $target * $nick $1-
    }
    else { echo $color(own text) -bfmt $+ $msgstamp $target < $+ $chr(3) $+ $owncolor(nick) $+ $nick $+ $chr(3) $+ > $1- }
    ; Halt further processing.
    halt
  }
}

; Process all private messages delivered to $me for which $me is not the target/recipient AND
; when a window for $me exists.
on ^*:TEXT:*:?:{
  if ($target != $me) {
    ; Make sure we have a query window to print to.
    if (!$window($target)) { query $target }
    ; Print message with proper formatting after checking if it's an ACTION.
    if ($gettok($rawmsg,4,32) == : $+ $chr(1) $+ ACTION) {
      echo $owncolor(action) -bfmt $+ $msgstamp $target * $nick $1-
    }
    else { echo $color(own text) -bfmt $+ $msgstamp $target < $+ $chr(3) $+ $owncolor(nick) $+ $nick $+ $chr(3) $+ > $1- }
    ; Halt further processing.
    halt
  }
}