Code:
on *:text:*:#:{
  if $nick isreg # { var %k = 1,%kk = $lines(spam.txt) | while %k <= %kk { 
      if $+(*,$read(spam.txt,%k),*) iswm $1- {
        if !$window(@Spams) { window -mze @Spams }
    echo -t @Spams $chan $nick : $1- | return $true } | inc %k } | return $false 
    write $qt($mircdirlogs\Spams.txt) $fulldate $chan $nick : $1-
  } 
}

i need fix this code to make it work for pvt and channel spams
and something wrong its not writing the log in Spams.txt confused