In reference to a request on another help forum, I came up with two possible codes for what they wanted.
However, neither code works and it appears the reason they aren't working is that the $iil isn't being filled when the invite is issued.
Here are the two codes that I wrote, and maybe someone can show and explain how they can be made to work.
Code:
on @*:join:#:{
  if $iil($chan,$nick) {
    .mode $chan +v $nick
  }
} 


Code:
on @*:join:#:{
  var %a = $iil($chan,0)
  while %a {
    if $nick isin $iil($chan,%a) {
      .mode $chan +v $nick
      %a = 0
    }
    dec %a
  }
} 


or maybe someone has an alternative suggestion.

The original request was for a script to voice bots/clients that are invited to the channel, but just the one's that are invited.