mIRC Homepage
Posted By: xCypherx Auto Unban - 06/01/05 05:24 PM
If any one will be so kind?? could it When i am banned it waits two seconds then sends to chanserv /cs unban #channel so its auto please? smile

Thanks in advance Cypher
Posted By: tidy_trax Re: Auto Unban - 06/01/05 05:30 PM
Code:
on @!*:ban:#:{
  if ($banmask iswm $address($me,5)) { .timer 1 2 cs unban $chan $v1 }
}
Posted By: xCypherx Re: Auto Unban - 06/01/05 06:04 PM
Quote:
Code:
on @!*:ban:#:{
  if ($banmask iswm $address($me,5)) { .timer 1 2 cs unban $chan $v1 }
}


Very Very Helpfull but how do i auto join channel again after it unbanned me?
Posted By: tidy_trax Re: Auto Unban - 06/01/05 06:27 PM
Code:
on @!*:ban:#:{
  if ($banmask iswm $address($me,5)) { 
    .timer 1 2 cs unban $chan $v1 
    .timer 1 3 if ( $me !ison $chan ) { join $chan }
  }
}
Posted By: xCypherx Re: Auto Unban - 06/01/05 06:37 PM
Quote:
Code:
on @!*:ban:#:{
  if ($banmask iswm $address($me,5)) { 
    .timer 1 2 cs unban $chan $v1 
    .timer 1 3 if ( $me !ison $chan ) { join $chan }
  }
}


Thanks alot but the auto join dont work frown after it unbans me i want it to join right away no wait

Thanks in Advance Cypher
Posted By: tidy_trax Re: Auto Unban - 06/01/05 06:41 PM
Code:
on @!*:ban:#:{
  if ($banmask iswm $address($me,5)) { 
    .timer 1 2 cs unban $chan $v1 $chr(124) if ( $me !ison $chan ) { join $chan }
  }
}


Make sure you paste the script in as you see it, syntax is important for this script.
Posted By: SladeKraven Re: Auto Unban - 06/01/05 06:43 PM
/help $banmask
/help Nick and Address Identifiers.
Posted By: FiberOPtics Re: Auto Unban - 06/01/05 07:01 PM
Since we are positive that your services are ChanServ, the best way to rejoin the channel is upon receiving the message that you are unbanned, rather than to use a timer.

Btw why do you only want to unban yourself after 2 seconds?

Anyway, this will do exactly as you want: when you get banned, after 2 seconds you will ask chanserv to unban you, and when chanserv does this, you will autojoin immediately, that is if you aren't on the channel already.


on @!*:BAN:#: if $banmask iswm $address($me,5) { .timer 1 2 cs unban # $!me }
[color:blue]

on *:NOTICE:*:?: {
tokenize 32 $strip($1-)
if $nick == ChanServ && $me !ison $6 && *bans* $me *cleared* iswm $1- { join $6 }
}
[/color]
Posted By: gonjos Re: Auto Unban - 27/07/08 08:13 AM
help me please....if i want to set auto unban after 14 days??

can i see the code???thx before
Posted By: RusselB Re: Auto Unban - 27/07/08 05:32 PM
Code:
on *:op:#:{
  if $opnick == $me {
    var %a = 1
    while %a <= $ibl($chan,0) {
      if $calc($ctime - $ibl($chan,%a).ctime) > 1209600 {
        .mode -b $chan $ibl($chan,%a)
    }
    else {
      .timer 1 $calc($v2 - $v1) .mode $safe($chan) -b $ibl($chan,%a)
    }
    inc %a
    }
  }
}
on *:ban:#:{
  .timer 1 1209600 .mode -b $safe($chan) $banmask
}
alias safe return $!decode( $encode($1,m) ,m)

Safe alias provided courtesy of Qwerty.
Posted By: Typos Re: Auto Unban - 28/07/08 08:34 AM
RusselB must have been in a hurry so Ill explain the code for him incase anyone wants to know.

It sets a timer when you ban the person to unban them in 14 days.
Since there is a darn good chance you wont stay connected or even have mirc open that long he also added some backups. Every time you are opped in a channel it checks every entry in the ban list and if it has been more than 14 days it unbanes them but if not it sets a timer to unset it in the remaining time it had.
So, if you restarted mirc and connected and were opped in #channel and #channel had one user who was banned 7 days ago, it will set a timer to unban that user in 7 days so they will have served the whole 14 days.

This is a pretty good system except for the fact that you can be reopped in a channel without having disconnected so this code can end up having multiple timers for each entry.

To fix this problem I will edit his code to include a name in the timer that uses the channel name and banned address and then if it is setting a timer that already exists it will just overwrite it instead of making a duplicate.

Also, while it may appear that the brackets are off and the else line and inc %a are outside the while loop it was just the way he wrote it, its actually just fine.

Anyone using the code should consider changing the # in the events to a specific channel. Don't forget you can do multiple channels by seperating with a comma like
Code:
on *:text:!trigger:#testing,#anotherchannel:{ commands }

Heres the new code with the timer line changed to name the timer so we can avoid multiple timers for each entry stacking up.
Code:
on *:op:#:{
  if $opnick == $me {
    var %a = 1
    while %a <= $ibl($chan,0) {
      if $calc($ctime - $ibl($chan,%a).ctime) > 1209600 {
        .mode -b $chan $ibl($chan,%a)
    }
    else {
      .timer $+ $chan $+ $ibl($chan,%a) 1 $calc($v2 - $v1) .mode $safe($chan) -b $ibl($chan,%a)
    }
    inc %a
    }
  }
}
on *:ban:#:{
  .timer 1 1209600 .mode -b $safe($chan) $banmask
}
alias safe return $!decode( $encode($1,m) ,m)

Good luck.
Posted By: RusselB Re: Auto Unban - 28/07/08 11:08 PM
Thanks for the explanation of my code... as you noted, I was in a bit of a hurry. Now to further implement the usage of the named timers that you were nice enough to start (and I'm a bit surprised that you didn't do this), here's the code with the named timer also being used in the on ban event, to ensure that a double timer isn't set
Code:
on *:op:#:{
  if $opnick == $me {
    var %a = 1
    while %a <= $ibl($chan,0) {
      if $calc($ctime - $ibl($chan,%a).ctime) > 1209600 {
        .mode -b $chan $ibl($chan,%a)
    }
    else {
      $+(.timer,$chan,$ibl($chan,%a)) 1 $calc($v2 - $v1) .mode $safe($chan) -b $ibl($chan,%a)
    }
    inc %a
    }
  }
}
on *:ban:#:{
  $+(.timer,$chan,$banmask) 1 1209600 .mode -b $safe($chan) $banmask
}
alias safe return $!decode( $encode($1,m) ,m)


Posted By: gonjos Re: Auto Unban - 02/08/08 07:40 PM
thanks a lot...first, i will open my dictionary to translate ...after that i will try de code to my irc...thank you so much
Posted By: RusselB Re: Auto Unban - 02/08/08 08:59 PM
For scripting purposes, to my knowledge, there is no difference as to what language you use. ie: A script for someone in the United States, where English/American is spoken will work without modification (unless there's specific text being presented), with a copy of mIRC that is being used by someone in Greece.
Posted By: gonjos Re: Auto Unban - 08/08/08 09:07 AM
sorry, i try to use that script but it doesn't work...
i use that script for my bot at Warcraft III PVPGN Server channel with mirc...

this is my script for my operator...
Code:
on 999:text:!ops*:?: {
  //msg $nick $2 Command for Operator...
  //msg $nick $2 Command Ban : /w Gonjos !Ban [Username] [time] [information]
}


and this is the command for my bot...
Code:
on 999:text:!ban*:?: { 
  /raw ban $2 $4- (Duration: $3 $+ ) (by OP: $nick $+ )
  /raw lockacct $2
  /writeini -n status.ini Status $2 Status : Banned
  /writeini -n status.ini Date $2 Date : $date(dd-mm-yyyy)
  /writeini -n status.ini Time $2 Time : $time(HH:nn)
  /writeini -n status.ini Duration $2 Duration : $3
  /writeini -n status.ini Information $2 Information : $4-
  /writeini -n status.ini by $2 by Operator : $nick
  /timer 1 $3 /raw unban $2
  /timer 1 $3 /raw unlockacct $2
  /timer 1 $3 /writeini -n status.ini Status $2 Status : Un-Banned
  /timer 1 $3 /writeini -n status.ini Information $2 Information : Your ID has been Un-Banned
}


but when i restart my mirc...that script will failed to auto unban...

can you help me to set that script so if i want to restart the mirc, the script still can to auto unban...

sorry if my english to bad...im from indonesia so i can speak english just a little... blush i hope you can understand..thanks
Posted By: RusselB Re: Auto Unban - 08/08/08 09:49 AM
When you re-started mIRC (technically when you disconnected mIRC from the network), all online timers were automatically disabled, so none of the /timer commands in your script would still be running.

Do you have any of the following events:
1) ON CONNECT
2) ON JOIN
3) ON START

If so, please post the code(s), as these are the areas where the unban command would have to be issued from for it to work upon a restart.
Posted By: mbab Re: Auto Unban - 09/08/08 07:37 PM
alias id { nickserv identify password}

alias bancheck {
if ( $chan($1).ibl == $true ) {
var %c = 1
while ( %c <= $ibl( $1,0 ) ) {
var %w = $ibl($1,%c)
if ( %w iswm ~r: $+ $fullname ) {
mode $1 -b %w
}
if ( ~c: isin %w ) {
if ( $right( %w,-3 ) ischan ) {
mode $1 -b %w
}
}
if ( %w iswm $address( $me,5 ) ) {
mode $1 -b %w
}
inc %c
}
else { halt }
}
}

on *:INVITE:#: {
if ( $fulladdress == ChanServ!services@services.utonet.org ) {
join $chan
}
}


on *:KICK:*: {
if ($knick == $me) {
cs invite $chan
}
}

on *:JOIN:#: {
if ( $nick == $me ) {
mode $chan +b
.timer $+ $chan -m 1 250 /bancheck $chan
}
}

on *:RAWMODE:#: {
if ( *-*o* iswm $1 ) && ( $me isin $2- ) {
chanserv op $chan $me
}
if ( *-*q* iswm $1 ) && ( $me isin $2- ) {
id
}
if ( *-*a* iswm $1 ) && ( $me isin $2- ) {
chanserv protect $chan $me
}
if (*-*h* iswm $1) && ( $me isin $2- ) {
chanserv halfop $chan $me
}
if (*-*v* iswm $1) && ( $me isin $2- ) {
chanserv voice $chan $me
}
if (*+*b* iswm $1) {
.timer $+ $chan -m 1 250 /bancheck $chan
}
}


}


Just put your password in first line.Using this script and its working ok:)
Posted By: RusselB Re: Auto Unban - 10/08/08 03:56 AM
In future, when posting code, please use the Code Tags button (looks like #)
Posted By: mbab Re: Auto Unban - 12/08/08 07:08 PM
Code:
[/code]Oh sorry.Sure np:)[code]
© mIRC Discussion Forums