Ban lock

By Lindrian on Dec 14, 2006

Okay, Me and my friend, Zack, have been working on a perfectly working ban lock for quite a while now. And we ended up with this.

How it works:
It only affects the bans YOU'VE set, and noones elses. It uses a *.ini file.
Just paste it into your remotes.

Please do not modify this snippet

If you find any bugs, Post them here and Ill see what i can do.

EDIT: Added menu.

Updated code.

Now im using Yoinx's banlock_build with smaller modifications.

on me:*:ban:#: {
  if ($banmask !iswm $ial($me)) {
    writeini -n bans.ini $chan $banmask 1
  }
}
on me:*:unban:#: {
  if ($readini(bans.ini,$chan,$banmask)) {
    .remini bans.ini $chan $banmask
  }
}
on !*:Unban:#: {
  if ($readini(bans.ini,$chan,$banmask)) && ($nick($chan,$me,oh)) {
    mode $chan +b $banmask
  }
}
on me:*:join:#: {
  mode $chan +b
  .timer 1 2 banlock_build $chan
}
alias banlock_build {
  var %x = 1, %y = $ibl($1,0)
  while (%x <= %y) {
    if ($ibl($1,%x).by == $me) writeini -n bans.ini $1 $+($1,.,$ibl($1,%x)) 1
    inc %x
  }
}
raw 367:*: halt
raw 368:*: halt

; ===========================================================
; For you who like a menu; here you go!
; ===========================================================

#banlock on
on me:*:ban:#: {
  if ($banmask !iswm $ial($me)) {
    writeini -n bans.ini $chan $banmask 1
  }
}
on me:*:unban:#: {
  if ($readini(bans.ini,$chan,$banmask)) {
    .remini bans.ini $chan $banmask
  }
}
on !*:Unban:#: {
  if ($readini(bans.ini,$chan,$banmask)) && ($nick($chan,$me,oh)) {
    mode $chan +b $banmask
  }
}
#Banlock end
#banlock_jcheck off
on me:*:join:#: {
  mode $chan +b
  .timer 1 2 banlock_build $chan
}
alias banlock_build {
  var %x = 1, %y = $ibl($1,0)
  while (%x <= %y) {
    if ($ibl($1,%x).by == $me) writeini -n bans.ini $1 $+($1,.,$ibl($1,%x)) 1
    inc %x
  }
}
raw 367:*: halt
raw 368:*: halt
#banlock_jcheck end
Menu * {
  .Ban Lock 
  ..Turn banlock $iif($group(#Banlock) == on,Off,On) : $iif($group(#Banlock) == on,disable,enable) #banlock 
  ..-
  ..$iif($group(#banlock_jcheck) == on,Disable,Enable) Banlock join update: $iif($group(#banlock_jcheck) == on,.Disable,.Enable) #banlock_jcheck
}

; ===================================================
; Yoinxs version
; ===================================================

on me:*:join:#: {
mode $chan +b
.timer 1 2 banlock_build $chan
}
alias banlock_build {
var %x = 1
while (%x <= $ibl($1,0)) {
if ($ibl($1,%x).by == $me) hadd -m banlock $+($1,.,$ibl($1,%x))
inc %x
}
}
on me:*:ban:#: {
hadd -m banlock $+($chan,.,$banmask)
}
on me:*:unban:#: {
hdel -w banlock $+($chan,.,$banmask)
}
on !*:unban:#: {
if ($hfind(banlock,$+($chan,.,$banmask),w,1)) || ($hfind(banlock,$+($chan,.,$banmask),W,1)) {
if ($me isop $chan) || ($me ishop $chan) mode $chan +b $banmask
}
}
raw 367:*: halt
raw 368:*: halt

Comments

Sign in to comment.
Lindrian   -  Jul 13, 2007

Code is now updated. Only mine, not yoinxs. Tested it, and it worked perfectly fine.

 Respond  
absolutguy   -  Jul 13, 2007

but having the on and off options would help it alot if you want to turn it off. nice snippet

 Respond  
Lindrian   -  Jul 13, 2007

You can always use the code Yoinx provided, scoll down in the list.

 Respond  
luiigi   -  Jul 13, 2007

same thing happened with me but just a matter of deleting the list and saving the file. if the bans.ini file gets filled up, just edit it by clearing the list and saving the blank file. or you can do it as often as you want to, that\'s what i do anyway.

 Respond  
sith_   -  Jun 02, 2007

when I used it, it wouldn\'t remove the bans from the ini file or whatever, so if someone else bans someone that was on that list and removed it, it would reban it.

 Respond  
Lindrian   -  Dec 25, 2006

Yoinx, it isnt working. Try it yourself. I get why your using it now, but the raws are not preventing it from spamming.

 Respond  
Yoinx   -  Dec 25, 2006

it should be hiding them, thats what the two raws at the bottom are for. The reason I have it there is to ensure the banlist updates properly.

 Respond  
Lindrian   -  Dec 25, 2006

Well, there\'s a problem. The

on me:*:join:#: {
mode $chan +b
.timer 1 2 banlock_build $chan
}

Will repeat all bans that are set in the channel, and if there are more then 5 bans in the channel, it will get really annoying. By removing the on

mode $chan +b

Part, it wont happend again. And I dont know why you got it there in the first place.

 Respond  
Lindrian   -  Dec 24, 2006

Very, very nice Yoinxs! Its working perfectly, and I have to thank you myself. Cause I was facing the same problem. I will add it into the snippet.

 Respond  
Yoinx   -  Dec 24, 2006

Yeah, Sorry... Thats because I never told it to delete the ban.

on me::join:#: {
mode $chan +b
.timer 1 2 banlock_build $chan
}
alias banlock_build {
var %x = 1
while (%x <= $ibl($1,0)) {
if ($ibl($1,%x).by == $me) hadd -m banlock $+($1,.,$ibl($1,%x))
inc %x
}
}
on me:
:ban:#: {
hadd -m banlock $+($chan,.,$banmask)
}
on me::unban:#: {
hdel -w banlock $+($chan,.,$banmask)
}
on !
:unban:#: {
if ($hfind(banlock,$+($chan,.,$banmask),w,1)) || ($hfind(banlock,$+($chan,.,$banmask),W,1)) {
if ($me isop $chan) || ($me ishop $chan) mode $chan +b $banmask
}
}
raw 367:: halt
raw 368:
: halt

that should work, though I have no idea why it was giving you problems with soushi.

 Respond  
Lindrian   -  Dec 24, 2006

Well, the problem is just like what I faced. The bans never get deleted from the ini/hash file/table and next one who sets the same ban, wont be able to unban.

 Respond  
Lindrian   -  Dec 24, 2006

Yeah, it is. but I have the script turned off on the clone.

 Respond  
Yoinx   -  Dec 24, 2006

thats weird. Soushi isnt your clone is it?

 Respond  
Lindrian   -  Dec 24, 2006

I took some time and tested it myself. It ws looking good until..
(22:42:42) mode: (Soushi) sets mode (+b test!@)
(22:42:44) mode: (Soushi) sets mode (-b test!@)
(22:42:44) mode: (Lindrian) sets mode (+b test!@)

That was the same problem that I used to have..

 Respond  
Lindrian   -  Dec 24, 2006

Have you tested it, and is it working properly? In that case, its another way to do it..

 Respond  
Yoinx   -  Dec 24, 2006

Something like this:

on me::join:#: {
mode $chan +b
.timer 1 2 banlock_build $chan
}
alias banlock_build {
var %x = 1
while (%x <= $ibl($1,0)) {
if ($ibl($1,%x).by == $me) hadd -m banlock $+($1,.,$ibl($1,%x))
inc %x
}
}
on me:
:ban:#: {
hadd -m banlock $+($chan,.,$banmask)
}
on !:unban:#: {
if ($hfind(banlock,$+($chan,.,$banmask),w,1)) || ($hfind(banlock,$+($chan,.,$banmask),W,1)) {
if ($me isop $chan) || ($me ishop $chan) mode $chan +b $banmask
}
}
raw 367:
: halt
raw 368:*: halt

 Respond  
Lindrian   -  Dec 24, 2006

Well, when I made this script, I only thought about acually using a INI file in the first place. And since they\'re easy to use, and its working just fine, I dont feel for changing anything!
But if you feel that your able to improve it Yoinx, Feel free to do it your way, test it out soo its working and give it to me, so I\'ll add it under mine. ofcourse, I will not take the credit for it.

 Respond  
Yoinx   -  Dec 24, 2006

I\'ve gotta ask this. Since its the most obvious one...

Why store all these to an ini....

Just loop through the $ibl to find $ibl($chan,x).by where the by address is you... add that address to your hash, and any that you set to the hash as well. Then, you can just search the hash anytime someone tries to do the ban/unbans...

You can also use this same technique to expire old bans everytime you join your channel.

 Respond  
Lindrian   -  Dec 24, 2006

Thank you! ;)

 Respond  
Nachos   -  Dec 24, 2006

I\'ve seen it in action, and it works. It works very good, actually.

 Respond  
Lindrian   -  Dec 24, 2006

Well, I noticed that the snippet were not re-writing the bans. And alot in the ini files got messed up. No need to get into details. Anyways, I managed to solve the problem, and the code is now totally updated.

 Respond  
RoninWarrior   -  Dec 23, 2006

so what about the big bug ?

 Respond  
Lindrian   -  Dec 17, 2006

Updated a few minor things, with some help from Yoinx\'s and jaytea.

 Respond  
RoninWarrior   -  Dec 14, 2006

lindarin it would good if you use the -n switch when useing writeini so that the text that is being stored isnt being evaulated this could cause serious risk to a channel and nick in genral

 Respond  
Lindrian   -  Dec 14, 2006

No acid. This only works on the person who owns the script. And the unban will only affect the bans the owner set himself.

And yes, I can add a menu if you like to.

 Respond  
Acid-Religion   -  Dec 14, 2006

Ohh, and also a way of turning it on and off? And it does affect bans other set as well... It just make sure that you are the only one that unbans them..

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.