mIRC Homepage
Posted By: starpossen Kickban with timer, need help - 08/04/10 03:03 PM
I found this script:
Code:
/kb { 
  /kick # $$1 $3-
  /mode # +b $$1
  /ignore $$1
  /set %time $calc($2 * 60)
  if (%time > 0) {
    /timerkb 1 %time /mode # -b $$1
    /timerkb1 1 $calc(1 + %time) /invite $$1 #
    /timerkb1 1 $calc(2 + %time) /ignore -r $$1
  }
  unset %time
}
 
/unban { 
  /mode # -b $$1
  /ignore -r $$1
  /invite $$1 #
}

It's working okay, but i'd like to change a few things:
Remove invite part
Ban before kick
and if you guys have any ideas on improvements, please let me know.
Posted By: Riamus2 Re: Kickban with timer, need help - 08/04/10 05:03 PM
If you look at the script, doing what you ask should be self-explanatory. Delete the lines that have invite on them, and move the kick line below the ban (+b) line. You can also remove every "/" as they aren't needed.
Posted By: starpossen Re: Kickban with timer, need help - 08/04/10 06:17 PM
You're right, I guess I was to quick to ask, before trying.

Another question, i'd like to modify it a bit further, I want to make a rightclick menu, where the first box would be time to ban next box the reason, how would I go about doing this?
Posted By: Riamus2 Re: Kickban with timer, need help - 08/04/10 06:37 PM
Np. Was just pointing out that scripting isn't really too hard until you get into more advanced scripts. For the most part, even if you don't know how to script, you should be able to have a little understanding of what each line is doing in basic scripts. Trying to make changes on your own is how you learn. smile

Code:
menu nicklist {
  Kick/Ban $1:ban -ku $+ $$?="How long (in seconds)?" $chan $$1 $$?="Why?"
}


Untested, but that should do it as long as I didn't mess up the order.

$?="" will put up a box to enter data to use. $1 in a nicklist menu will be the selected nick(s). /help /ban for details on using -ku to kick and remove the ban after so many seconds. The use of $$ prevents it from doing anything if there is no data for that identifier.

Note that you can use that with your /kb alias if you want to.

Code:
menu nicklist {
  Kick/Ban $1:ban -ku $+ $$?="How long (in seconds)?" $chan $$1 $$?="Why?"
}


Untested, but that should do it as long as I didn't mess up the order.

$?="" will put up a box to enter data to use. $1 in a nicklist menu will be the selected nick(s). /help /ban for details on using -ku to kick and remove the ban after so many seconds. The use of $$ prevents it from doing anything if there is no data for that identifier.

Note that you can use that with your /kb alias if you want to. It just requires updating the alias:

In Remote:
Code:
menu nicklist {
  Kick/Ban $1:kb $$?="How long (in seconds)?" $chan $$1 $$?="Why?"
}


In Alias (or put "alias" in front of kb { (alias kb {) and leave it in Remote with the menu.
Code:
kb { 
  ; $1 = Time, $2 = Channel, $3 = Nick, $4- = Reason
  mode $2 +b $3
  kick $2 $3 $4-
  ignore $3
  if ($1 > 0) {
    .timerkb 1 $1 mode $2 -b $3
    .timerkb1 1 $calc(2 + $1) ignore -r $3
  }
}


As a note, the kick line cound just be kick $2- since it uses everything from $2 on. I prefer to keep items separated like this, though, as it is a bit easier to read imo.
Posted By: chacha Re: Kickban with timer, need help - 08/04/10 08:18 PM
/help /ignore

=> /ignore -uN

Code:
alias kb {
  if $active == # && $2 {
    ban -ku $+ $2 $1 2 $3-
    ignore -u $+ $2 $1
    .timerkb 1 $2 invite $1 #
  }
}
alias unban {
  mode # -b $$1
  ignore -r $$1
  invite $$1 #
  if ($timer(kb)) .timerkb off
}
Posted By: Riamus2 Re: Kickban with timer, need help - 08/04/10 09:07 PM
Yeah, I know. Ignore and ban can both be done with -u. I just let his alias basically alone. As for the alias, if it's only used from the menu, you don't have to check $chan or $2. Also, if you're using -u on invite, you need to add 2 to it as he had in the original. $calc($1 + 2).

And, -ku isn't really what he was wanting for /ban. That ends up kicking then banning someone, which means they can sometimes get back in before the ban takes effect (what he asked for originally to avoid). That's why I left them separate for him.

Oh, and $1 is the time, not $2. Here's an edit just in case the OP wants to use -u.
Code:
kb { 
  ; $1 = Time, $2 = Channel, $3 = Nick, $4- = Reason
  ban -u $+ $1 $2 $3
  kick $2 $3 $4-
  ignore -u $+ $calc($1 + 2) $3
  if ($1 > 0) {
    .timerkb 1 $1 mode $2 -b $3
  }
}


I left the > 0 in there just in case someone goes and puts something they shouldn't into the time dialog and causes issues. As long as the person using the script pays attention while typing the time, that check isn't needed, of course.
© mIRC Discussion Forums