Why not replace the separating char $chr(32) with a "$chr(38)-and-space" after the loop
Code:
    while (%nicknum >= %nick1) { 
      if ($nick($chan,%nick1) isin $strip($2-)) {  
        var %nicklijst = $addtok(%nicklijst,$v1,32)
      } 
      inc %nick1 
    }
    var %nicklijst = $replace(%nicklijst,$chr(32),$+($chr(38),$chr(32)))

Quote:
Somehow i need to use the name of the bot where the script is located in order to get it to work.
I want this to work too without use the bots name.
I don't get this part. Can you please provide an example and show the piece of code that if-condition is a part of?