This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
nsrafk
Halfop
Posts: 73 Joined: Fri May 11, 2007 12:25 am
Post
by nsrafk » Thu May 24, 2007 7:32 am
Hi all. I've downloaded 'CCAS Netbots Edition' by Loki. (Complete Channel Administration System)
I have a question, to change to banmask the script uses.
In the script i see:
Code: Select all
# The following proc makes a proper hostmask for use with banning, etc..
#------------------------------------------------------------------------------------------------------------
proc getmask {nick chan} {
set mask [string trimleft [maskhost [getchanhost $nick $chan]] *!]
set mask *!*$mask
return $mask
}
#------------------------------------------------------------------------------------------------------------
# The following proc makes a proper hostmask for use with banning, etc..
#------------------------------------------------------------------------------------------------------------
proc warnban {nick mask chan bantime warn rest} {
global color1loki rulebreaker pbannounce
if {$warn == 0} { set rulebreaker($mask) "0 [unixtime]" }
if {![info exists rulebreaker($mask)]} {
set rulebreaker($mask) "$warn [unixtime]"
}
if {[expr [unixtime] - [lindex $rulebreaker($mask) 1]] > 259200} {
set rulebreaker($mask) "$warn [unixtime]"
}
if {[lindex $rulebreaker($mask) 0] < 1} {
foreach activeban [banlist $chan] {
if {[lindex $activeban 0] == $mask} {return 1}
}
puthelp "PRIVMSG $nick :$color1loki You have triggered an AutoBan: $rest \(Perm Ban\)"
putlog "\0033 4 $nick \($mask\) has been Auto Perm Banned"
puthelp "PRIVMSG $pbannounce :4 $nick \($mask\) has been Auto Perm Banned from $chan \(5 Reason: $rest\) Type !override to undo"
set rulebreaker(overmask) "$mask"
newban $mask "Autoban" $rest 20000
unset rulebreaker($mask)
putkick $chan $nick "AutoBan: $rest \(Perm Banned\)"
} elseif {[lindex $rulebreaker($mask) 0] == 1} {
foreach activeban [banlist $chan] {
if {[lindex $activeban 0] == $mask} {
set rulebreaker($mask) "[expr [lindex $rulebreaker($mask) 0] - 1] [lindex $rulebreaker($mask) 1]"
return 1
}
}
if {$bantime != 0} {
puthelp "PRIVMSG $nick :$color1loki You have triggered an AutoBan: $rest \[Last Warning\] \($bantime min ban\)"
newchanban $chan $mask "Autoban" $rest $bantime
}
set rulebreaker($mask) "[expr [lindex $rulebreaker($mask) 0] - 1] [lindex $rulebreaker($mask) 1]"
putkick $chan $nick "AutoBan: $rest !-Last Warning-! \($bantime min ban\)"
} else {
foreach activeban [banlist $chan] {
if {[lindex $activeban 0] == $mask} {
set rulebreaker($mask) "[expr [lindex $rulebreaker($mask) 0] - 1] [lindex $rulebreaker($mask) 1]"
return 1
}
}
if {$bantime != 0} {
puthelp "PRIVMSG $nick :$color1loki You have triggered an AutoBan: $rest \[1st Warning\] \($bantime min ban\)"
newchanban $chan $mask "Autoban" $rest $bantime
}
set rulebreaker($mask) "[expr [lindex $rulebreaker($mask) 0] - 1] [lindex $rulebreaker($mask) 1]"
putkick $chan $nick "AutoBan: $rest !-Warning-! \($bantime min ban\)"
}
return 1
}
When using this my eggdrop sets a ban like this:
*!*Love@*.quakenet.org
I want the ban to look something like:
*!*Love@GeRbeNsEn.users.quakenet.org
I've tried to mess around with this, but im too stupid to make it work lol.
Thanks for any help!
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Thu May 24, 2007 7:48 am
Changing the "getmask" proc to something like this should work;
Code: Select all
proc getmask {nick chan} {
return *!*[getchanhost $nick $chan]
}
NML_375
nsrafk
Halfop
Posts: 73 Joined: Fri May 11, 2007 12:25 am
Post
by nsrafk » Thu May 24, 2007 9:04 am
Ok, thanks. Ill try it and see if it works
nsrafk
Halfop
Posts: 73 Joined: Fri May 11, 2007 12:25 am
Post
by nsrafk » Thu May 24, 2007 9:11 am
It works, thanks. There's just one problem though. It sets bane like this:
*!*~
ident@host.com
is there a way to strip the ~ ?
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Thu May 24, 2007 10:04 am
Code: Select all
proc getmask {nick chan} {
return *!*[string trimleft [getchanhost $nick $chan] "~"]
}
NML_375
nsrafk
Halfop
Posts: 73 Joined: Fri May 11, 2007 12:25 am
Post
by nsrafk » Thu May 24, 2007 10:23 am
Thanks mate. Works perfect.
nsrafk
Halfop
Posts: 73 Joined: Fri May 11, 2007 12:25 am
Post
by nsrafk » Thu May 24, 2007 10:34 am
One last thing - how would the proc look like if i would set bans like *!*@host.com ?
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Thu May 24, 2007 10:46 am
For this, there are several options. Two most common would be to either split the hostmask into a list (using
split with "@" as split-character), and then, using
lindex , select the last list-element; or, using
string first to find the location of the @, and then use "string range" to select a substring..
In either case you would have no further need for the "string trimleft".
NML_375
nsrafk
Halfop
Posts: 73 Joined: Fri May 11, 2007 12:25 am
Post
by nsrafk » Thu May 24, 2007 11:10 am
ok, it seems that i really need to read now.. cos that i have no clue on hwo to do..
EDIT:
seems like the first way to do it with split is the easiest way to do it. How would i put it then? Something like;
Code: Select all
[strip [getchanhost $nick $chan] "@"]
And then im lost with the lindex stuff. Can u please show me a working example of this? Sorry for being stupid at this hehe
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Thu May 24, 2007 1:21 pm
returns user@host
returns a list containing 'user' and 'host' {user host}.
The index of 'user' is 0 and the index of 'host' is 1. Since you want the host, you use:
Code: Select all
lindex [split [getchanhost $nick $chan] @] 1
so, to get *!*@host:
Code: Select all
set mask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
nsrafk
Halfop
Posts: 73 Joined: Fri May 11, 2007 12:25 am
Post
by nsrafk » Thu May 24, 2007 2:41 pm
Oh, thanks so much! That was very helpful! You're good at explaining man. Thanks!