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.

/msg nick join and part

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
R
Riddler
Halfop
Posts: 60
Joined: Sun May 20, 2007 10:20 pm
Location: Brasov, Romania
Contact:

Post by Riddler »

YooHoo wrote:I looked everywhere for this "killuser" command, and didn't find squat. Where'd you get this at?

Code: Select all

  deluser <handle>
    Description: attempts to erase the user record for a handle
    Returns: 1 if successful, 0 if no such user exists
    Module: core
oki...thanks for the advice...

New modification to the Code and i have this:

Code: Select all

bind msg n addchan s:addchan 
bind msg n delchan s:delchan 

proc s:addchan {nick uhost hand text} { 
 global botnick default-flags 
  if {$text == "" || [string index $text 0] != "#"} { 
    putserv "NOTICE $nick :SYNTAX: /msg $botnick addchan #channel" 
    } elseif {[validchan $text]} { 
    putserv "NOTICE $nick :\002$text \002is already added" 
    } else { 
    channel add $text 
    newuser ~$text $default-flags 
    chattr ~$text +C 
    putserv "NOTICE $nick :Channel added:\002 $text \002" 
  } 
} 

proc s:delchan {nick uhost hand text} { 
 global botnick 
  if {$text == "" || [string index $text 0] != "#"} { 
    putserv "NOTICE $nick :SYNTAX: /msg $botnick delchan #channel" 
    } elseif {![validchan $text]} { 
    putserv "NOTICE $nick :\002$text \002is not a valid channel" 
    } else { 
    channel remove $text 
    deluser ~$text 
    putserv "NOTICE $nick :Channel deleted:\002 $text \002" 
  } 
}
Ok, the delchan command works great, but the addchan command has still an error.

Code: Select all

 [14:28] Tcl error [s:addchan]: can't read "default": no such variable
.....
I am a man of few words, but many riddles
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Tcl has some issues with a few characters, such as "-", within variable names. In these cases you need to enclose the variable name with {}, ie. ${default-flags}.
NML_375
x
xU
Voice
Posts: 7
Joined: Thu May 24, 2007 4:04 pm

Post by xU »

Hi, :D

Code: Select all

############################################## Date: 25May06 ############################
##      xU (Qadsia@hotmail.com        WeArab: #Qadsia ########      msg-part.tcl        #
#########################################################################################

#########################################################################################
#                                                             #       Note:             #
#                    Name: MeShari                            #                         #
#                Nickname:  xU                                #        None             #
#                     IRC: Irc.WeArab.Net: -j #qadsia         #                         #
#                   Email: Qadsia@hotmail.com                 #                         #
#                                                             #                         #
#                                                             ###########################
#########################################################################################
 

## bind ##
##########
bind msgm - * proc:privmsg

## proc ##
##########
proc proc:privmsg { nick uhost hand text } {
set text [string tolower $text]
if {([stirng tolower bondie] == "[string tolower $nick]")} {
if {[lindex $text 0]) == "!join")} {
if {([lindex $text 1] == "")} {putquick "privmsg $nick :WARNING: Please enter Channel /msg <botnet> !join #channel"}
if {([botonchan [lindex $text 1]])} {putquick "privmsg $nick :WARNING: Iam already on channel!"
} else {
if {([lindex $text 1]) != "")} {putquick "privmsg $chan :NOTE: Try to join [lindex $text 1];channel add [lindex $text 1];utimer 1 save}
}
}
if {[lindex $text 0]) == "!part")} {
if {([lindex $text 1] == "")} {putquick "privmsg $nick :WARNING: Please enter Channel /msg <botnet> !part #channel"}
if {(![botonchan [lindex $text 1]])} {putquick "privmsg $nick :WARNING: Iam not in channel!"
} else {
if {([lindex $text 1]) != "")} {putquick "privmsg $chan :NOTE: Try to part [lindex $text 1];channel remove [lindex $text 1];utimer 1 save}
}
}
}
}
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@xU:
Try replacing "stirng" with "string". And dont, ever, use lindex on plain strings! It's designed to be used on proper tcl-lists only (list and split is your friend here).

Also, I am abit confused as to why you have a hardcoded nick in the middle of the code...

Finally, for simple informational msgs, you'd be better off using puthelp rather than putquick.
NML_375
R
Riddler
Halfop
Posts: 60
Joined: Sun May 20, 2007 10:20 pm
Location: Brasov, Romania
Contact:

Post by Riddler »

nml375 wrote:Tcl has some issues with a few characters, such as "-", within variable names. In these cases you need to enclose the variable name with {}, ie. ${default-flags}.
Thank you nml375 :D , the script works great now...just didn`t need no more for the $default-flags, because the eggdrop.conf has a option to set them and the adduser comand work with that option. 8)

The new cod :

Code: Select all

bind msg n addchan s:addchan
bind msg n delchan s:delchan

proc s:addchan {nick uhost hand text} {
 global botnick default-flags
  if {$text == "" || [string index $text 0] != "#"} {
    putserv "NOTICE $nick :SYNTAX: /msg $botnick addchan #channel"
    } elseif {[validchan $text]} {
    putserv "NOTICE $nick :\002$text \002is already added"
    } else {
    channel add $text
    adduser ~$text
    chattr ~$text +C
    putserv "NOTICE $nick :Channel added:\002 $text \002"
  }
}

proc s:delchan {nick uhost hand text} {
 global botnick
  if {$text == "" || [string index $text 0] != "#"} {
    putserv "NOTICE $nick :SYNTAX: /msg $botnick delchan #channel"
    } elseif {![validchan $text]} {
    putserv "NOTICE $nick :\002$text \002is not a valid channel"
    } else {
    channel remove $text
    deluser ~$text
    putserv "NOTICE $nick :Channel deleted:\002 $text \002"
  }
}
now I ask one last thing, how do add an option that will not add the username to the database with the "#" in front of the name ?

Code: Select all

<|Rbot1> [00:38] |Rbot2: newuser ~#chan hp
(01:41:09) <|Rbot1> [00:38] |Rbot2: chattr ~#chan hpC
----
<h4nd> .whois ~#chan
<|Rbot1> [00:37] #h4nd# whois ~#chan
<|Rbot1> HANDLE       PASS NOTES FLAGS           LAST
<|Rbot1> ~#chan      no       0 hpC             never (nowhere)
a simple adduser without the "#" , some thing like this:

Code: Select all

<h4nd> .whois ~chan
<|Rbot1> [00:37] #h4nd# whois ~chan
<|Rbot1> HANDLE       PASS NOTES FLAGS           LAST
<|Rbot1> ~chan      no       0 hpC             never (nowhere)
I am a man of few words, but many riddles
n
notrox
Voice
Posts: 5
Joined: Mon May 28, 2007 10:33 pm

Post by notrox »

i'm looking for the exact same thing , but to msg me when anyone joins a selected channel
Post Reply