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.

Ban type problems! + Probs with tcl

Old posts that have not been replied to for several years.
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Ban type problems! + Probs with tcl

Post by guest »

Hey ppl could u tell me how to make my bot to put a ban like
*!*ident@*.host.com but not like *!~ident@host.com or *!ident@host.com
??? :roll:
Last edited by guest on Mon Aug 30, 2004 2:15 pm, edited 1 time in total.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

# Set this to 1 if you don't want your the bot to strip a leading '~' on
# user@hosts.
set strict-host 0
After that, an adress without a ~ in the ident will be set as *!ident@host.com else it will be *!*ident@host.com
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Alchera:
I think he wanted to use the banmask:

*!*ident@*.host.com (while placing bans)

Well, guest, the only way you can do this is by using tcl scripts.
Suppose you have a procedure:

Code: Select all

proc my_procedure {nick uhost arg1 arg2....argn}
 global bla bla .................
 .............................................
 ...................................................
 #stuff here (what ever your script is doing!)
 ...................................................................
 #for getting the banmask of the user in *!*ident@*.host.com
 #you can use something like this if you have the uhost:

 set banmask "*!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]"
 .............................................
 putserv "MODE $chan +b $banmask"
 putserv "KICK $chan $nick :Bye bye!"
 ........................
 ................................
 }
}
For a banmask like *!*ident@*.host.com use:
set banmask "*!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]"

For a banmask like *!~ident@host.com use:
set banmask "*![lindex [split $uhost "@"] 0]@[lindex [split $uhost "@"] 1]"

For a banmask like *!ident@host.com use:
set banmask "*![string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split $uhost "@"] 1]"

For a banmask like *!*ident@host.com use:
set banmask "*!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split $uhost "@"] 1]"
or
set banmask "*!*$uhost"

Remember, if you are using a bind like join, nick, kick, part or a bind without raw then you can get the uhost (user@host) for the user. :wink:

If you are using bind raw, then you first need to get the uhost with the $from variable. Something like this:

Code: Select all

set nick [lindex [split $from "!"] 0]
set uhost [getchanhost $nick]
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

yep alchera i had set strict-host 0 in my cfg!

now thnx awyeah for your advice it helped me to solve one problem now i'm having some problems with another tcl !
bind pub B|B ban Banyti

proc Banyti {Kikintojas uhost hand Kanalas rest} {
if {$rest == ""} {
putserv "NOTICE $Kikintojas :Vartojimas: cya <nikas> (priezhastis)"
return 0
}
set Kikinamasis [lindex $rest 0]
set reas [lrange $rest 1 end]
if {[getchanhost $Kikinamasis $Kanalas] == ""} {
putserv "NOTICE $Kikintojas :Ko norejai?"
return 0
}
if {[matchattr $hand m|m $Kanalas]} {
putserv "MODE $Kanalas -o+b $Kikinamasis [getchanhost $Kikinamasis $Kanalas]"
putserv "KICK $Kanalas $Kikinamasis :$reas"
return 1
}
if {[matchattr [nick2hand $Kikinamasis $Kanalas] mn|mn $Kanalas] || [matchattr $Kikinamasis b]} {
putserv "NOTICE $Kikintojas :suka zhiurek ka darai! ;)"
return 0
}
if {[matchattr $hand o|o $Kanalas]} {
putserv "MODE $Kanalas -o+b $Kikinamasis [getchanhost $Kikinamasis $Kanalas]"
putserv "KICK $Kanalas $Kikinamasis :$reas"
return 1
}
}

and i want this lil script to make bans like that "*!*ident@*host.com" as well so maybe u could help me with this one as well?

sorry 4 my english... thnx in advance
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

guest wrote:and i want this lil script to man bans like *!*ident@*host.com as well so maybe u could help me with this one as well?
This was already answered...
awyeah wrote:for getting the banmask of the user in *!*ident@*.host.com you can use something like this if you have the uhost:

Code: Select all

set banmask "*!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]"
As a side observation, you might wish to update this script a bit, seems a tad out-dated. For example -

• replace putserv "NOTICE $channel with putnotc $chan

• replace putserv "KICK $channel $nick with the putkick command.

• I would suggest altering your procedure to include the bot setting a newchanban immediately before the victim is kicked from the channel, otherwise you run the risk of kick-flood (if the victim had "auto-rejoin" enabled in thier script, for example). Or you could email it to me and I'll do it for you :lol:
:mrgreen: just my 2 cents :mrgreen:
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

so ok and where should i put that line then? :roll:
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

You can add it anywhere to this procedure, however, I would suggest adding it with the other private variables you have in this script...

Code: Select all

...
set Kikinamasis ...
set reas ...
set banmask ...
...
You will need to alter the specific parameters of this string to fit your procedure, but it should be enough :mrgreen:
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

omg ...
could u please be more specific cuz i don't understand anything... :oops: :roll: :o
shame on me ... but i'm definitely not a scripter
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Here use this:
(This should place bans in the format: *!*ident@*.host.com)

Code: Select all

bind pub B|B ban Banyti 

proc Banyti {Kikintojas uhost hand Kanalas rest} { 
if {$rest == ""} { 
putquick "NOTICE $Kikintojas :Vartojimas: cya <nikas> (priezhastis)" -next
return 0 
} 
set Kikinamasis [lindex $rest 0] 
set reas [lrange $rest 1 end] 
if {[getchanhost $Kikinamasis $Kanalas] == ""} { 
putquick "NOTICE $Kikintojas :Ko norejai?" -next
return 0 
} 
if {[matchattr $hand m|m $Kanalas]} { 
putquick "MODE $Kanalas -o+b $Kikinamasis *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]" -next
putquick "KICK $Kanalas $Kikinamasis :$reas" -next
return 1 
} 
if {[matchattr [nick2hand $Kikinamasis $Kanalas] mn|mn $Kanalas] || [matchattr $Kikinamasis b]} { 
putquick "NOTICE $Kikintojas :suka zhiurek ka darai!" -next
return 0 
} 
if {[matchattr $hand o|o $Kanalas]} { 
putquick "MODE $Kanalas -o+b $Kikinamasis *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]" -next
putquick "KICK $Kanalas $Kikinamasis :$reas" -next
return 1 
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

• replace putserv "NOTICE $channel with putnotc $chan

• replace putserv "KICK $channel $nick with the putkick command.
If you take a look at alltools.tcl putserv "NOTICE $chan..." has been remapped to putnotc $chan, it is the same I guess.

As for putkick it will cause all kicks to be sent in 1 line, like pushmode, only if your ircd allows fast kicks and lots of kicks to be pushed in one line, this is however a slow method. :P
• I would suggest altering your procedure to include the bot setting a newchanban immediately before the victim is kicked from the channel, otherwise you run the risk of kick-flood (if the victim had "auto-rejoin" enabled in thier script, for example). Or you could email it to me and I'll do it for you :lol:
I wouldn't see why there would be a need for newchanban, putserv "MODE $chan +b $banmask" in the script does the banning part, and once when the user is banned he cannot rejoin back hence there will be no kick flood at all. :wink:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

yayps awyeah :D now it bans me!

Code: Select all

bind pub B|B ban Banyti
proc Banyti {Kikintojas uhost hand Kanalas rest} {
if {$rest == ""} {
putserv "NOTICE $Kikintojas :Vartojimas: cya <nikas> (priezhastis)" -next
return 0
}

set Kikinamasis [lindex $rest 0]
set reas [lrange $rest 1 end]
if {[getchanhost $Kikinamasis $Kanalas] == ""} {
putquick "NOTICE $Kikintojas :Ko norejai?" -next
return 0
}
if {[matchattr $hand m|m $Kanalas]} {
putquick "MODE $Kanalas -o+b $Kikinamasis *!*[string trimleft [lindex [split $uhost "@"] 0] "~"$
putquick "KICK $Kanalas $Kikinamasis :$reas" -next
return 1
}
if {[matchattr [nick2hand $Kikinamasis $Kanalas] mn|mn $Kanalas] || [matchattr $Kikinamasis b]}$
putquick "NOTICE $Kikintojas :suka zhiurek ka darai!" -next
return 0
}
if {[matchattr $hand o|o $Kanalas]} {
putquick "MODE $Kanalas -o+b $Kikinamasis *!*[string trimleft [lindex [split $uhost "@"] 0] "~"$
 putquick "KICK $Kanalas $Kikinamasis :$reas" -next
 return 1
 }
}
and it does this stuff:
[18:18] >< Mode (@nevykes:#audi -o+b Zoro *!*bnc@*.velniai.net)
>< [Banned]: Hooligan
[18:18] >< Zoro was kicked by @nevykes (nevykes)
it kicks zoro but sets ban on me :mrgreen:
Hooligan (bnc@shaman.velniai.net)
Zoro (~Zoro@81-7-74-212.ip.takas.lt)

any comments....
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Here use this, this should do it:

Code: Select all

bind pub B|B ban Banyti 

proc Banyti {Kikintojas uhost hand Kanalas rest} { 
if {$rest == ""} { 
putserv "NOTICE $Kikintojas :Vartojimas: cya <nikas> (priezhastis)" -next 
return 0 
} 
set Kikinamasis [lindex $rest 0]
set reas [lrange $rest 1 end]
set uhost [getchanhost $Kikinamasis]
if {[getchanhost $Kikinamasis $Kanalas] == ""} { 
putquick "NOTICE $Kikintojas :Ko norejai?" -next 
return 0 
} 
if {[matchattr $hand m|m $Kanalas]} { 
putquick "MODE $Kanalas -o+b $Kikinamasis *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]" -next
putquick "KICK $Kanalas $Kikinamasis :$reas" -next 
return 1 
} 
if {[matchattr [nick2hand $Kikinamasis $Kanalas] mn|mn $Kanalas] || [matchattr $Kikinamasis b]}$ 
putquick "NOTICE $Kikintojas :suka zhiurek ka darai!" -next 
return 0 
} 
if {[matchattr $hand o|o $Kanalas]} { 
putquick "MODE $Kanalas -o+b $Kikinamasis *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]" -next putquick "KICK $Kanalas $Kikinamasis :$reas" -next 
 return 1 
 } 
} 
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

:roll: i think it isn't working as well
[18:00] Tcl error in file 'eggdrop.conf':
[18:00] can't read "hand": no such variable
while executing
"matchattr $hand o|o $Kanalas"
(file "scripts/chancmd.tcl" line 1)
(file "eggdrop.conf" line 1)
[18:00] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

:cry:
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Okay give this a go. :mrgreen:
I have modified and optimized (reduced un-necessary lines) the code. :P

Code: Select all

bind pub B|B ban pub:kick:ban

proc pub:kick:ban {nick uhost hand chan text} {
 set person [lindex $text 0]; set reason [lrange $text 1 end] 
 set host [getchanhost $person]; set handle [nick2hand $person $chan]
 if {($text == "")} { putserv "NOTICE $nick :Vartojimas: cya <nikas> (priezhastis)"; return 0 }
  if {($host == "")} { putserv "NOTICE $nick :Ko norejai?"; return 0 }
   if {([matchattr $handle mn|mn $chan]) || ([matchattr $handle b|b $chan])}
     putquick "NOTICE $nick :suka zhiurek ka darai!" -next; return 0
     } 
     if {([matchattr $hand m|m $chan]) || ([matchattr $hand o|o $chan])} { 
      putquick "MODE $nick -o+b $person *!*[string trimleft [lindex [split $host "@"] 0] "~"]@[lindex [split [maskhost $host] "@"] 1]" -next
      putquick "KICK $chan $person :$reason" -next; return 0
      } 
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

i think it means the same ... :wink:
[20:58] Tcl error in file 'eggdrop.conf':
[20:58] can't read "hand": no such variable
while executing
"matchattr $hand m|m $chan"
(file "scripts/chancmd.tcl" line 1)
(file "eggdrop.conf" line 1)
[20:58] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

but it also means that smth is wrong :oops: :cry:
Locked