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.
Old posts that have not been replied to for several years.
Carnage69
Halfop
Posts: 64 Joined: Sat Jun 07, 2003 8:25 pm
Post
by Carnage69 » Sat Apr 03, 2004 8:11 pm
hello i am making a login logout script the login command i think works havent tested it yet the .ops command works just the logout command i need it to remove the nick from the file and it is not working can someone please help me thanks!
Code: Select all
bind pub - .login proc_login
proc proc_login {nick uhost handle channel arg} {
set file ops
if {![file exists $file]} {close [open $file w]}
set io [open $file a+]
puts $io $nick
close $io
putserv "NOTICE $nick :You Are Now LOGED IN"
}
bind pub - .logout proc_logout
proc proc_logout {nick uhost handle channel arg} {
set file ops
if {![file exists $file]} {close [open $file w]}
set io [open $file r+]
puts $io $nick
close $io
putserv "NOTICE $nick :You Are Now LOGED OUT"
}
bind pub - .ops proc_ops
proc proc_ops {nick uhost handle channel arg} {
set file ops
if {![file exists $file]} {close [open $file w]}
set io [open $file r]
set list ""
while {![eof $io]} {
gets $io line
if {[string trim $line] == ""} {continue}
lappend list $line
}
close $io
set message "\0002Available Ops\002 :"
putserv "PRIVMSG $channel :$message"
foreach line $list {
putquick "PRIVMSG $channel :$line"
}
}
Xpert
Halfop
Posts: 88 Joined: Mon Mar 08, 2004 7:03 am
Post
by Xpert » Sun Apr 04, 2004 4:47 am
Code: Select all
Try this:
bind pub - .logout proc_logout
proc proc_logout {nick uhost handle channel arg} {
set file ops
if {![file exists $file]} {close [open $file w]}
set in [open $file "r"]
set out [open ${file}.tmp "w+"]
while {![eof $in]} {
set line [gets $in]
if {![string equal -nocase "$line" "$nick"} {
puts $out $line
}
}
close $in
close $out
exec "rm $file"
exec "cp ${file}.tmp $file"
exec "rm ${file}.tmp"
putserv "NOTICE $nick :You Are Now LOGED OUT"
}
Should work, not tested
Xpert.
dollar
Op
Posts: 178 Joined: Tue Oct 28, 2003 3:47 pm
Location: Netherlands
Post
by dollar » Sun Apr 04, 2004 4:55 am
Xpert wrote: Code: Select all
Try this:
bind pub - .logout proc_logout
proc proc_logout {nick uhost handle channel arg} {
set file ops
if {![file exists $file]} {close [open $file w]}
set in [open $file "r"]
set out [open ${file}.tmp "w+"]
while {![eof $in]} {
set line [gets $in]
if {![string equal -nocase "$line" "$nick"} {
puts $out $line
}
}
close $in
close $out
exec "rm $file"
exec "cp ${file}.tmp $file"
exec "rm ${file}.tmp"
putserv "NOTICE $nick :You Are Now LOGED OUT"
}
Should work, not tested
Why not use TCL's "file" functions?
dollar (or something similar) at:
#eggdrop / #tcl - undernet
#egghelp / #tcl / #eggtcl - efnet
#eggdrop.support / #tcl - quakenet
#eggdrop - ircnet
Carnage69
Halfop
Posts: 64 Joined: Sat Jun 07, 2003 8:25 pm
Post
by Carnage69 » Sun Apr 04, 2004 1:28 pm
i get this error
[12:26] Tcl error [proc_logout]: missing close-bracket
and i cant find were it is missing
Xpert
Halfop
Posts: 88 Joined: Mon Mar 08, 2004 7:03 am
Post
by Xpert » Sun Apr 04, 2004 1:31 pm
Oh, my mistake.
Change this:
Code: Select all
if {![string equal -nocase "$line" "$nick"} {
to:
Code: Select all
if {![string equal -nocase "$line" "$nick"]} {
Xpert.
Carnage69
Halfop
Posts: 64 Joined: Sat Jun 07, 2003 8:25 pm
Post
by Carnage69 » Sun Apr 04, 2004 3:42 pm
now i get this
[14:41] Tcl error [proc_logout]: couldn't execute "rm ops": no such file or directory
GodOfSuicide
Master
Posts: 463 Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria
Post
by GodOfSuicide » Mon Apr 05, 2004 8:25 am
Carnage69 wrote: now i get this
[14:41] Tcl error [proc_logout]: couldn't execute "rm ops": no such file or directory
dont use exec's, tcl's "file" command provides such a feature
file delete ?-force? ?- -? pathname ?pathname ... ?
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Apr 05, 2004 8:37 am
...also, use 'file rename' instead of 'exec cp'+'exec rm'. But why use a file to store those nicks? Storing them in an array would make things alot easier.
Have you ever read "The Manual"?
Ofloo
Owner
Posts: 953 Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:
Post
by Ofloo » Thu Apr 08, 2004 4:56 pm
not sur if
this is what u looking for but from what i can see i gues u are
XplaiN but think of me as stupid