mIRC Home    About    Download    Register    News    Help

Print Thread
#123749 27/06/05 06:21 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
well in this case i need full script help because i dont know how to pull this out...

my "request" is this:
when i join channel that mirc get list of all bans for channel
and write them in .INI or what ever file... can .txt
AND if some time... that ban list (bans) are removed from channel that i return all those bans back.

so actually my question is can mirc
1. read ban list from channel
2. write them to file (when readed)
3. and detect if blist is empty in channel

this possible ?


IceCapped
#123750 27/06/05 10:42 AM
Joined: Mar 2005
Posts: 74
D
Babel fish
Offline
Babel fish
D
Joined: Mar 2005
Posts: 74
Very simple script:

on *:JOIN:#: {
if ($nick == $me) { .remini ban.ini # | .mode # +b }
}

raw 367:*: {
.writeini ban.ini $2 bans $calc($readini(ban.ini,$2,bans) +1)
.writeini ban.ini $2 $readini(ban.ini,$2,bans) $3
haltdef
}

alias checkbans {
if !$1 { echo -a Enter a channelname! | halt }
if ($me !isop $1) { echo -a Must be op on $1 to reban | halt }
if ($readini(ban.ini,$1,bans) == 0) { echo -a Logged banlist is empty | halt }
var %i = 1 | var %m = $readini(ban.ini,$1,bans)
while (%i <= %m) {
mode $1 +b $readini(ban.ini,$1,%i)
inc %i
}
}

--
This does:
1) When you join a channel, clears logged banlist from that channel. And asks the server for a new one.
2) When server answers you with the banlist, it logs the new banlist into ban.ini
3) When you type: /checkbans #Channel it will reban all logged masks.

#123751 27/06/05 11:04 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009

1) When you join a channel, clears logged banlist from that channel. And asks the server for a new one.

then what is point of saving banlist ?

2) When server answers you with the banlist, it logs the new banlist into ban.ini

3) When you type: /checkbans #Channel it will reban all logged masks.

and if second time on join it is empty ?
i got erased all my previous blist and nothing to reban then :tongue:


IceCapped
#123752 27/06/05 07:18 PM
Joined: Mar 2005
Posts: 74
D
Babel fish
Offline
Babel fish
D
Joined: Mar 2005
Posts: 74
The point of clearing is, that the list doesn't get uber long. If you dont want this, then i suggest removing the 'remini ban.ini $1 |' part.

Doing so, will result in the banlist getting larger and larger. To counter this, place the line above in the last line of the checkbans alias. Now it will clear once that alias has been called.

The alias will echo to you, when the list is empty and/or when you're not an OP on that channel. If the ban is already in place, it will try to overwrite, but wont succeed. You're not getting an error msg for this.

#123753 27/06/05 08:04 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
no way to just update list (overwrite) instead:
clearing it
or
just adding and adding

?


IceCapped
#123754 28/06/05 08:13 AM
Joined: Mar 2005
Posts: 74
D
Babel fish
Offline
Babel fish
D
Joined: Mar 2005
Posts: 74
; Ok, to update a channels banlist:
alias update.banlist {
if $1 { mode $1 +b }
}
; And to remove one:
alias clear.banlist {
if $1 { .remini ban.ini $1 }
}

; And if you want, when you want to update, it clears it.
alias update.banlist {
if $1 { .remini ban.ini $1 | mode $1 +b }
}

#123755 28/06/05 01:25 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
alright !
thanks for help and effort !

btw can you now add it to WHOLE script laugh
coz im noob at this things smirk

Last edited by raZOR; 28/06/05 01:30 PM.

IceCapped
#123756 28/06/05 05:04 PM
Joined: Mar 2005
Posts: 74
D
Babel fish
Offline
Babel fish
D
Joined: Mar 2005
Posts: 74
;### Usage:
; /update.banlist #Channel or /update.banlist (in a channel)
; /clear.banlist #Channel or /clear.banlist (in a channel)
;
; And /checkbans #Channel

alias clear.banlist {
if $1 { .remini ban.ini $1 }
if !$1 {
if ($me ison $active) {
.remini ban.ini $1
}
}
}


alias update.banlist {
if $1 {
clear.banlist $1
mode $1 +b
}
if !$1 {
if ($me ison $active) {
clear.banlist $1
mode $1 +b
}
}
}


raw 367:*: {
.writeini ban.ini $2 bans $calc($readini(ban.ini,$2,bans) +1)
.writeini ban.ini $2 $readini(ban.ini,$2,bans) $3
haltdef
}

alias checkbans {
if !$1 { echo -a Enter a channelname! | halt }
if ($me !isop $1) { echo -a Must be op on $1 to reban | halt }
if ($readini(ban.ini,$1,bans) == 0) { echo -a Logged banlist is empty | halt }
var %i = 1 | var %m = $readini(ban.ini,$1,bans)
while (%i <= %m) {
mode $1 +b $readini(ban.ini,$1,%i)
inc %i
}
}

#123757 01/07/05 07:43 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
cool !
thanks =)

sorry for delay, i went over my traffic limit so my isp...

thanks again !


IceCapped

Link Copied to Clipboard