Code:
 on *:TEXT:!vote*:#: {
  if ($gettok(%daynight,1,32) == day) {
    var %x %plyrs
    while (%x > 0) {
      if ($nick == $gettok([ % $+ plyr $+ [ %x ] ],1,32)) {
        var %y %plyrs
        while (%y > 0) {
          if ($1 == $gettok([ % $+ [ plyr $+ [ %y ] ] ],1,32)) {
            msg $chan got to here
            $puttok([ % $+ plyr $+ [ %x ] ],$1,4,32)
            var %votes $gettok([ % $+ plyr $+ [ %y ] ],5,32)
            var %v $calc($gettok(%votes,1,46) + 1)
            var %votes $puttok(%votes,%v,1,46)
            var %votes $addtok(%votes,$nick,46)
            $puttok([ % $+ plyr $+ [ %y ] ],%votes,5,32)
          }
          dec %y 1
        }
      }
      dec %x 1
    }
  }
}
 

I was worried id mess up the syntax if I put all the token stuff in the middle on one line so I broke it up with local variables (I haven't tested it yet), but thats not my problem. I've narrowed it down to this line:
if ($1 == $gettok([ % $+ [ plyr $+ [ %y ] ] ],1,32))
This should compare the parameter with the first tok in %plyrY (whick would be someones nick). It doesnt return true though. I get:

* /if: insufficient parameters (line 86, script.ini)

I've tried using $+() $(,2) and various bracket combinations so I'm confused.