Hi everyone. I'm new to the forum.
i wrote two small scripts. The first goes to bot A, which should be placed in channel A, and which reads and sends all new nicknames that enter to bot B.

addon 2 that goes into bot B
receives nicknames from bot A and having the operator flag in channel B invites all nicknames to channel B.

The addons work.
but I want better.
I want invitations to be 1 in 20.
I'll explain:
There are two possible solutions.
Solution n1 Bot A counts new nicknames that enter and sends bot B only one nick every 20.

solution n 2
Bot B gets all the nicknames from bot A, but invites only one in 20.

I can't do it.
can you help me?

Code
  ;######|BOT A (LEGGE I NICK E LI INVIA AL BOT B)|##########
on 1:join:#x: {
  set %mexjoin Benvenuto in Shoganai ^^ | set %newjoin $nick
  if ($nick != $me) { .inc %joins 1 } {
    msg # %mexjoin $+ $nick sei il numero %joins | msg BotB %newjoin 
  }
  unset %newjoin
}  


;#######|BOT B (RICEVE IL NICK DAL BOT A, E MANDA L'INVITO)|######
On 1:text:*:?: {
  if ($nick == Bot-A) {
    set %nickinvite $1- { 
      msg #shoganai !invite %nickinvite | close -m  
    }
  }
  unset %nickinvite
}