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.

Finding $nick $victim

Old posts that have not been replied to for several years.
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Finding $nick $victim

Post by iamdeath »

Hi, I am trying to write a tcl, but I am stucked somewhere in the middle.

Okay can you explain me how it works, like when we ban someone in DCC how the bot finds out the victims nick and ban him in the channl or globally...

.+ban *!*@lovely.users.undernet.org
bot kicked Baba (Banned)

Can you explain me this process, with a little tcl code?...

another similiar question:

Code: Select all

 

bind dcc o|o sayhi dcc:sayhi 
dcc:sayhi {handle idx text} { 
 
If I have a CService Username of a Person, and in DCC I want to perform .sayhi lovely, how can I make the bot finds out that persons nickname or check who is using *!*@lovely.users.undernet.org and msg him, }else{ msg $idx..

can you please explain me this in a little code?..

Please don't ask me why I need this stupid thing, actually this is a part of my TCL which I am currently working on, and also need to learn new things about TCL, I think foreach loop will work on it but I am not sure, so I am asking for assistance.

Thanks.
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Re: Finding $nick $victim

Post by YooHoo »

iamdeath wrote:Okay can you explain me how it works, like when we ban someone in DCC how the bot finds out the victims nick and ban him in the channl or globally...
.+ban *!*@lovely.users.undernet.org
bot kicked Baba (Banned)
The bot didn't find the victim's nick, the ban was placed against the uhost *!*@lovely.users.undernet.org, and will ban any/all users from this domain.
iamdeath wrote:

Code: Select all

bind dcc o|o sayhi dcc:sayhi 
dcc:sayhi {handle idx text} { 
If I have a CService Username of a Person, and in DCC I want to perform .sayhi lovely, how can I make the bot finds out that persons nickname or check who is using *!*@lovely.users.undernet.org and msg him, }else{ msg $idx..
this snippet of code is incomplete, and therefore will not work. I am familiar with where you got it however, and i suggest you copy the entire procedure to make it functional. As for the last part of your question, I suggest you read the beginner's guide to tcl, as this should provide the in-depth answers you seek :wink:
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

If you don't want to answer please don't mess with the question leave it, let others answer, yes that code is incomplete read the whole bloody thing, I can't complete it. and I've read all the guides I cant get the solution. So please don't reply if you don't want to solve this issue.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

well, he actually answered your first question, so don't be so touchy

as of your second question, here's how you do that:

Code: Select all

set victim ""
set yourmask *@goober.users.undernet.org
foreach nick [chanlist #channel] {
   if [string match -nocase $yourmask [getchanhost $nick $channel]] {
      set victim $nick
      break
   }
}
# now you have goober's nick in $victim (or "" if not found on #channel)
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks alot, I really appreciate your kind help, let me try please.
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Well thanks your kind help, but there is still a problem, everything goes fine but when that person is not in the channel the bot is not sending me a note or something putdcc $idx is'nt working, it stays idle quite, no error nothing, if that person is in the channel the bot goes right through the TCL, here is the code of my tcl..

Code: Select all


set ac(chan) "#company"
set ac(owner_username) "iamdeath"
set ac(bot_username) "Defensive"
set notifyusers "iamdeath"
set rule1 "This is the first Rule .... "
set rule2 "This is the Second Rule."
set rule3 "This is the Third Rule..."
set reason "Congrats, you've been selected for the OP in $ac(chan)."
bind dcc n adduser ac:adduser
proc ac:adduser { handle idx text } {
ac:get_list
global ac user_names notifyusers rule1 rule2 rule3 reason
if {$text == ""} { putdcc $idx "Syntax: .adduser <CService username>"; return }
foreach arg $user_names {
if {[string tolower $arg] == [string tolower $text]} {
putdcc $idx "Username $text already exists!"
return
}
if {$arg == ""} { continue }
}
set victim " "
set maskhost *@$text.users.undernet.org
foreach nick [chanlist $ac(chan)] {
	if [string match -nocase $maskhost [getchanhost $nick $ac(chan)]] {
	set victim $nick
	if {![onchan $victim $ac(chan)]} {putdcc $idx "$victim is not in $ac(chan)"; return}
lappend user_names $text
putdcc $idx "Username $text added!"
puthelp "PRIVMSG X :ADDUSER $ac(chan) $text 1"
adduser $text *!*@$text.users.undernet.org
chattr $text |+fo $ac(chan)
        putkick $ac(chan) $victim $reason        
        puthelp "PRIVMSG $victim :$rule1"
        puthelp "PRIVMSG $victim :$rule2"
        puthelp "PRIVMSG $victim :$rule3"
}
}
if {$notifyusers != "" && $notifyusers != " "} {
foreach notfuser $notifyusers {
sendnote IDA_SYSTEM $notfuser "Added Username $text in $ac(chan) by $handle."
}
}
ac:write_acdb
}

Here are the results:
THIS IS WHEN THAT PERSON IS IN THE CHANNEL.....
--------------------------------------------------------------
THE BOT..
<iamdeath> .adduser zohaib
<(Defensive> Username zohaib added!
<(Defensive> [03:29] -X (cservice@undernet.org)- Added user Zohaib to #Company with access level 1

THE USER
Shows Rules to the Person too..
[Defensive!~flirt-rul@Defensive.users.undernet.org] This is the first Rule ....
[Defensive!~flirt-rul@Defensive.users.undernet.org] This is the Second Rule.
[Defensive!~flirt-rul@Defensive.users.undernet.org] This is the Third Rule...
-------------------------------------------
THIS IS WHEN THAT PERSON IS NOT IN THE CHANNEL.
----------------------------------------------------------------
<iamdeath> .adduser Zohaib
<iamdeath> .adduser zohaib ( NO REPLY, so I typed "." to check "
<iamdeath> .
<(Defensive> Ambiguous command.
I'll be thankful if you help me out with this problem, I've not pasted the whole script so few things are used in other parts.
Thanks.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

you can add a check after the foreach loop:

Code: Select all

if {![llength $victim]} {
 # victim is not in channel
}
Edit: and you'll have to do it like demond told you instead of stacking all the commands inside the foreach loop.
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Where should I put it?.. ;/

Code: Select all

set victim " "
set maskhost *!*@$text.users.undernet.org
foreach nick [chanlist $ac(chan)] {
if [string match -nocase $maskhost [getchanhost $nick $ac(chan)]] {
set victim $nick
if {![llength $victim]} {putdcc $idx "$text $maskhost is not in $ac(chan)"; return}
Still the same problem...

I also tried

Code: Select all

set victim " "
set maskhost *@$text.users.undernet.org
foreach nick [chanlist $ac(chan)] {
if ![string match -nocase $maskhost [getchanhost $nick $ac(chan)]] { putdcc $idx "$text $maskhost is not in $ac(chan)"; return}
if [string match -nocase $maskhost [getchanhost $nick $ac(chan)]] {
set victim $nick
}
}
in this CASE, the bot always says.
For everyone :D haha, even those whoare in the channel...
[05:07] <|AmDeAtH> .adduser Zohaib
[05:07] <Defensive> Zohaib *!*@Zohaib.users.undernet.org is not in #company
[05:18] <|AmDeAtH> .adduser jpotter
[05:18] <Defensive> jpotter *!*@jpotter.users.undernet.org is not in #company
somebody really help me out :D..
Last edited by iamdeath on Tue Jul 12, 2005 8:21 pm, edited 1 time in total.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

 set victim " " 
 set maskhost *@$text.users.undernet.org 
 foreach nick [chanlist $ac(chan)] { 
  if [string match -nocase $maskhost [getchanhost $nick $ac(chan)]] { 
   set victim $nick
   break
  }
 }
 if {![llength $victim]} {
  putdcc $idx "there are no matches for $maskhost on $ac(chan)"
 } {
  lappend user_names $text 
  putdcc $idx "Username $text added!" 
  puthelp "PRIVMSG X :ADDUSER $ac(chan) $text 1" 
  adduser $text *!*@$text.users.undernet.org 
  chattr $text |+fo $ac(chan) 
  putkick $ac(chan) $victim $reason        
  puthelp "PRIVMSG $victim :$rule1" 
  puthelp "PRIVMSG $victim :$rule2" 
  puthelp "PRIVMSG $victim :$rule3"
 }
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Lemme try that thanks..
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks mate it works :lol:
-------------------------------
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

demond wrote:well, he actually answered your first question, so don't be so touchy
He is actually a she :lol: but ty all the same
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

demond once wondered "Are there girls who use eggdrop?" :lol:
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well I happen to come across some chicks using eggdrops; one or two of them were lebanese and blonde! :shock:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

awyeah wrote:Well I happen to come across some chicks using eggdrops; one or two of them were lebanese and blonde! :shock:
Are you saying that lebanese chicks are dumb? :evil: just kidding :lol: (ps: I'm blonde too, half belarussian)
Locked