Wims: If you're going to post code, please use the Code Tags button. It looks like the # character, and is located in the bar at the top of these message areas.

Also please watch your formats, as you are using incorrect format for setting some of the variables, as well as setting variables when not required.

Here's a re-write of the code you posted.
Code:
on *:nick:{
  var %i = $numtok($badnick,32)
  while (%i) {
    if $+(*,$gettok($badnick,%i,32),*) iswm $newnick) { hinc -m badnick $newnick }
    dec %i
  }
  if ($hget(badnick,$nick)) hdel badnick $nick
  var %h = $hget(badnick,%n) ,%cmd = $iif(%h == 1,msg x kick,$iif(%h == 2,ban -k))
  if (%cmd) && ($me isop #sigbin) && ($newnick !isop $v2) %cmd $v2 $newnick $iif(%h == 2,2) Badnick !
  if (%h == 2) hdel badnick $newnick
}