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
Part, it wont happend again. And I dont know why you got it there in the first place.
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.
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
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.
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.