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.

Error in adduser setup?

Help for those learning Tcl or writing their own scripts.
Post Reply
N
Nara
Halfop
Posts: 40
Joined: Sun Jul 23, 2006 11:12 pm

Error in adduser setup?

Post by Nara »

Code: Select all

proc battle:adddj { nick host hand chan text } {
[adduser [join [lindex [split $text] 0] [join [lrange [split $text] 1 end]]] [chattr [join [lindex [split $text] 0] fD]
putlog "$head $nick added new dj: [join [lindex [split $text] 0] with hostmask: [join [lrange [split $text] 1 end]]]"
}

proc battle:removedj { nick host hand chan text } {
[deluser $text]
putlog "$head $nick removed dj: $text"
}
It refuses to add them - no errors are returned, but the person is not added. Here's the format:

@adduser HANDLE HOSTMASK

EX:
@adduser Nara *!*@Nara.*

~Nara
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Just a question, why do you try to execute the return-code form adduser and deluser?
And this $head-variable you have in that putlog; it's not defined anywhere in this code, and it's not imported from globalspace

Also, would you mind including the binds you've used?

edit: Had a closer look at that adduser code..
To be honest, I'm not sure what you try to accomplish with all those nested commands

A simple example on how to do it would be something like this:

Code: Select all

proc battle:adddj {nick host hand chan text} {
 set txt [split $text]; set handle [lindex $txt 0]; hostmask [lindex $txt 1]
 if {[adduser $handle $hostmask]} {
  chattr $handle fD
  putlog "$nick added new dj: $handle with hostmask: $hostmask"
 }
}

proc battle:removedj {nick host hand chan text} {
 if {[deluser $text]} {
  putlog "$nick removed dj: $text"
 }
}

bind pub n @adduser battle:adddj
bind pub n @deluser battle:removedj
Of course you don't need to set txt, handle or hostmask; tho I find it makes the code somewhat more easy to read
NML_375
Post Reply