I have some scripts about kick ban blacklisted, and they all set the inc variable %kick.count the same, but why does kick increase the number by 3 or 2 units.
I want each kick to increase %kick.count by 1 unit. Please help me. Thank you very much!

Here is my code:

Код:
alias -l ban_time_blacklist { return $rand(3600,10800) }
ON @*:TEXT:*:#: {
  tokenize 32 $strip($1-)

  if ($1 == .bl) { ignore -u5 $nick
    if ($network !== DaVang) || (!$read(userbot.txt,nw,$nick)) || ($nick isreg #userbot) { return }
    if (!$2) && ($2 !== $me) && ($2 !== $nick) && ($2 !ison $chan) && ($2 !isreg $chan) { return }
    if ($read(userbot.txt,nw,$2)) { return }

    inc %kick.count
    var %reason = $read(atb_blacklistreason.txt,nt)

    var %h = $ial($2).host
    var %u = $ial($2).user
    var %t = $ial(*@ $+ %h,0)

    if (%t == 1) { kick_bl $2 $chan $remove(%u,~) %h %kick.count %reason | return }

    var %i = 1
    while (%i <= %t) {
      var %n = $ial(*@ $+ %h,%i).nick 
      var %a = $ial(*@ $+ %h,%i).host

      if (%h == %a) { var %tot = $addtok(%tot,%n,32) }

      inc %i
    }

    if (!%tot) { return }

    var %z = 1
    while (%z <= $numtok(%tot,32)) {
      var %n_name = $gettok(%tot,%z,32)
      var %n_host = $ial(%n_name).host
      var %n_ident = $ial(%n_name).user

      kick_bl %n_name $chan $remove(%n_ident,~) %n_host %kick.count %reason

      inc %z
    }
  }
}

alias -l kick_bl {
  ; /kick_bl <nickname> <#channel> <ident> <host> <ID> <reason>

  if (!$1) || (!$2) || (!$3) || (!$4) || (!$5) || (!$6) { return }

  var %txt_db = atb_blacklistdatabase.txt

  if (*irccloud* iswm $4) || (*Davang-* iswm $4) {

    mode $2 +b $gettok($ial($1).host,1,46) $+ .*

    kick $2 $1 4([Banned] (reason: $6- $+ ) $chr(91) $+ id: $5 $+ $chr(93) - (for more information regarding your ban please join #help to ask for removal))

    var %r = $read(%txt_db,nw,* $+ $gettok($ial($1).host,1,46) $+ .*)

    if (!%r) { write $qt(%txt_db) $+([id:,$chr(32),$5,],$chr(59),$gettok($ial($1).host,1,46) $+ .*,$chr(59),$6-) | .notice $nick Added $+  $gettok($ial($1).host,1,46) $+ .*  $+ to %txt_db successfull. }

    .timer[UNBAN_ $+ $2 $+ _ $+ $gettok($ial($1).host,1,46) $+ ] 1 $ban_time_blacklist mode $2 -b *!*@ $+ $gettok($ial($1).host,1,46) $+ .*
  }
  else {
    ban $+(-ku,$ban_time_blacklist) $2 $1 2 4([Banned] (reason: $6- $+ ) $chr(91) $+ id: $5 $+ $chr(93) - (for more information regarding your ban please join #help to ask for removal))

    var %r = $read(%txt_db,nw,* $+ $4 $+ *)

    if (!%r) { write $qt(%txt_db) $+([id:,$chr(32),$5,],$chr(59),*!*@,$4,$chr(59),$6-) | .notice $nick Added $+  *!*@ $+ $4  $+ to %txt_db successfull. }
  }
}

Here is some example for .bl (blacklisted) command:

1)

[14:57:09] <@Kendy> .bl Test
[14:57:10] * ChanGuard sets mode: +b *!*@Davang-UAICHW.*
[14:57:10] * Test was kicked from #public by ChanGuard (([Banned] (reason: You are no longer welcome here) [id: 11] - (for more information regarding your ban please join #help to ask for removal))) <=== the id is 11, but the next kick is 14. I want add 1 unit is: id 12

2)

[14:58:14] <@Kendy> .bl Test
[14:58:14] * ChanGuard sets mode: +b *!*@Davang-UAICHW.*
[14:58:14] * Test was kicked from #public by ChanGuard (([Banned] (reason: You are no longer welcome here) [id: 14] - (for more information regarding your ban please join #help to ask for removal)))

I WANT THE NEXT KICK INCREASE 1 UNIT.

Note: When my Bot disconnect the reconnect to server. The kick count is increase 2 or 3 Units again.

Отредактировано Robert (08.01.2023 13:45)