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.

[SOLVED] Request: TCL script correction

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

[SOLVED] Request: TCL script correction

Post by guest »

Hello eggdrop forumers, i have this kind of a script, which should kickban person with a chan command 'cya'. It does it job but not the way i would like it to! It sets ban with a wrong host! like *!~blabla@blabla.com but i would like it to set a ban like *!*ident@*.host.com

so that's the story, would be cool if u can help me, here's my script :

Code: Select all

bind pub B|B cya 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 
} 
} 
sorry for my english,
thnx in advance
Last edited by guest on Fri Sep 10, 2004 1:30 pm, edited 1 time in total.
k
kem
Voice
Posts: 6
Joined: Sat May 22, 2004 11:25 am

Post by kem »

Code: Select all

 
proc Banyti {Kikintojas uhost hand Kanalas rest} { 
set banmask *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]
[...]
putserv "MODE $Kanalas -o+b $Kikinamasis $banmask" 
putserv "KICK $Kanalas $Kikinamasis :$reas" 
return 1 
} 
[...]
if {[matchattr $hand o|o $Kanalas]} { 
putserv "MODE $Kanalas -o+b $Kikinamasis $banmask" 
putserv "KICK $Kanalas $Kikinamasis :$reas" 
return 1 
} 
}
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

Now my code is like u told me to do it looks like that...

Code: Select all

bind pub B|B cya Banyti
proc Banyti {Kikintojas uhost hand Kanalas rest} {
set banmask *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]
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 $banmask"
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 $banmask"
putserv "KICK $Kanalas $Kikinamasis :$reas"
return 1
}
}
but it bans me, instead of person who i want to ban in irc it looks like that :
Whois Hooligan = Hooligan (bnc@shaman.velniai.net)
Whois savas = savas (ubaldas@aitvaras.net)
<@Hooligan> cya savas
Mode (@nevykes:#audi -o+b savas *!*bnc@*.velniai.net)
Mode (@savas:#audi +o savas)
savas was kicked by @nevykes (nevykes)
any ideas about that?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Its because it bans on your uhost as shown in the code.

set banmask *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]
g
guest
Halfop
Posts: 52
Joined: Mon Jan 19, 2004 4:15 pm

Post by guest »

so how to make the script ban not me but the person i want?
User avatar
esix
Voice
Posts: 39
Joined: Thu Aug 12, 2004 11:16 am
Location: [esix@localhost]
Contact:

Post by esix »

i think if you change

Code: Select all

set banmask *!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]
to

Code: Select all

set banmask *!*[string trimleft [lindex [split $host "@"] 0] "~"]@[lindex [split [maskhost $host] "@"] 1]
it will work right, at least i hope so :)
The End
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

This has already been discussed and I remade the script quite alot of times in one of the threads in the eggdrop forum.

Here is the link:
http://forum.egghelp.org/viewtopic.php?t=8147
·­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 »

but then script doesnt work at all
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Honestly I have no idea why it doesn't work. To me and to all the people there it looks fine, its just a simple code indeed. :roll:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Well, using $uhost in there makes no sense, as thats the person triggering the script and not the victim. Using $host is no good either, as it havent been defined anywhere.

So just looking at the script briefly, i sugeest that you move that set banmask line further down in your script (to where you actually need it) and then perform a getchanhost on the victim's nick, (set in the Kikinamasis var, as far as I can tell)

Just a sidenote, you can make the eggdrop strip ~ from idents automaticly by setting strict-host to 0 in your config file.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Erm.. yeah, use it in a this way then:

Code: Select all

set strict-host "0"
#To trim of the "~" in the ident.

Code: Select all

...............
...................
........................
if {($rest == "")} { 
putserv "NOTICE $Kikintojas :Vartojimas: cya <nikas> (priezhastis)" 
return 0 
} 
set Kikinamasis [lindex $rest 0]
set reas [lrange $rest 1 end]
set uhost [getchanhost $Kikinamasis $chan]
set banmask "*!*[lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]"
if {($uhost == "")} { 
putserv "NOTICE $Kikintojas :Ko norejai?" 
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 »

now it seems to work! :D


but ... :roll: look at that ...

eggdrop.conf
..........
set strict-host 0
set quiet-reject 0
set lowercase-ctcp 0
..............
and bot does this
[10:39] <@Hooligan> cya [place]
[10:39] Mode (@nevykes:#audi -o+b [place] *!*~bazooka@*.vet.lt)
[10:39] [place] was kicked by @nevykes (nevykes)
maybe i should put one more set strict-host "0" in my tcl script?
EDIT: It doesn't help either...
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Haha, go ask 'gb' now. I know the strict-host is a useless function because it always doesn't work. That's why I never used it and never recommend it. Trimming the "~" in host of the string is the best way to deal with this.

Hmmm, I think I know why it wasn't stripped because we are splitting the uhost into the ident and host region between the @ to make the banmask ourself. If we don't split and just use the variable $uhost in the proc then in the result for $uhost will have a stripped "~". But here we cannot use $uhost as you want maskhost with the lindex 1 of the $uhost. So the best way is to trim it anyhow.

Anyway you had set strict-host to 0 in your eggdrop.conf, so it is set as global anyway, no need to set it in the tcl, as it is the same. You can set it in your .conf file or .tcl files, the end result will be the same as they will be global in both cases.

Now what you can do here to 100% strip that "~" from all bans is replace this:

Code: Select all

set banmask "*!*[lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]"
with this code:

Code: Select all

set banmask "*!*[string trimleft [lindex [split $uhost "@"] 0] "~"]@[lindex [split [maskhost $uhost] "@"] 1]"
and then your problem would have been solved! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

I really dont see any problem
<gb> .tcl getchanhost Nick #chan
<bot> Tcl: ~ident@dsl-123-456.isp.com

<gb> .tcl maskhost [getchanhost Nick #chan]
<bot> Tcl: *!*ident@*.isp.com
You guys are dumb :mrgreen:
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

I know the strict-host is a useless function because it always doesn't work.
Since when?

I have actually tested that setting in more than one bot on more than one shell (Sun, FreeBSD & Red Hat) and it works exactly as intended. :P
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Locked