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.

need some help

Old posts that have not been replied to for several years.
Locked
M
MarlbMan
Voice
Posts: 20
Joined: Tue Apr 15, 2003 9:20 pm

need some help

Post by MarlbMan »

I have some code here that isnt working, I'm sure there are tons of things wrong with it, if anyone wants to help me out and pick it apart, It'd be much appreciated.

Code: Select all

set operid "vhost"
set operpass "vhost5728"
set nspass "vhost5728"
set operchan "#Administrator"
set stdchan "#militia"
bind pub -|- !vhost pub:vhost
bind pub O !approve pub:approve
bind pub O !reject pub:reject
bind pub O !pending pub:pending
bind pub O !oper pub:oper
bind pub O !ident pub:ident

proc pub:oper {nick host chan text} {
     global operid operpass operchan
     putserv "OPER $operid $operpass"
     putserv "PRIVMSG $operchan : Power Up!"
     }
proc pub:ident {nick host chan text} {
     global nspass operchan
     putserv "PRIVMSG NickServ : identify $nspass"
     putserv "PRIVMSG $operchan : Identified!"
     }
proc pub:vhost {nick host chan text min hour month day year} {
     global operchan
     set hostdb [open hostdb.txt w+]
     set seq [read hostdb.txt 2]
     if {$seq > 00} {incr seq 01} else {set seq 01}
     puts $hostdb "$seq $nick $text $hour : $min $month / $day / $year"
     close hostdb.txt
     return 0
     }
proc pub:pending {nick host chan text} {
     set hostdb [open hostdb.txt r]
     set pend [read hostdb.txt]
     putserv "PRIVMSG $operchan : $pend"
     close hostdb.txt
     return 0
     }
proc pub:reject {nick host chan text} {
     set hostdb [open hostdb.txt w+]
     set rjct ""
     set finished 0
     while {![eof $hostdb] && !$finished} {
     gets $hostdb line
     if {[lindex $line 0] == $text} {
     set rjct "[lrange $line 1 end]"
     set finished 1
     }
     }
     if {$rjct != ""} {
          set rjnick [lindex $rjct 2]
          set rjhost [lindex $rjct 3]
          putserv "PRIVMSG $operchan : $rjct rejected"
          putserv "PRIVMSG $stdchan : $rjnick : Your vhost of  $rjhost has
been rejected"
          puts $line ""
          }
          else { putserv "PRIVMSG $operchan :$text does not exist in my
database"
          }
          return 0
          close hostdb.txt
          }
proc pub:approve {nick host chan text} {
     set hostdb [open hostdb.txt w+
     set appr ""
     set finished 0
     while {!eof $hostdb $$ !finished} {
     gets $hostdb line
     if {[lindex $line o] == $text} {
     set appr "[lrange $line 1 end]"
     set finished 1
     }
     }
     if {$appr != ""} {
          set apnick [lindex $rjct 2]
          set aphost [lindex $rjct 3]
          putserv "PRIVMSG $operchan : $appr approved"
          putserv "PRIVMSG $stdchan : $apnick : Your vhost of  $aphost has
been approved and will take effect next time you log in"
          putserv "PRIVMSG HostServ : set $apnick $aphost"
          puts $line ""
          }
          else { putserv "PRIVMSG $operchan :$text does not exist in my
database"
          }
          return 0
          close hostdb.txt
          }
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well all of these are procedures some are big and some are quite simple and easy as the first few ones.

All the procedures you have listed here aren't working? or just some specific? Are they giving errors? or are they just not responding to the triggers??

Is the bind "O" +O a user flag defined?? If not change to it to small 'o'.
I know the bind "o" +o user flag is defined for ops.

For this to be easy:
[1] What you can do is use putlogs in each lines of the procedures which aren't working or giving any output to check where the errors are.

[2] If you get an [Tcl error:proc_name] in DCC (partyline) then you can paste it here so we maybe able to look at it.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Is the bind "O" +O a user flag defined?? If not change to it to small 'o'.
+O under some IRCD's is set for Oper only channels. So my guess is that it's a user defined flag. :)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

The +O flag denotes OPER only channels (only opers may join) like in bahamut, but this has no concern with the bots internal flags.

Also the +O flag in IRCd's denotes an (O:line) Global Oper. But it doesn't have any concern with the bot's internal flags, as they are totally different from the IRCd and have no concern between each other. :mrgreen:

So for channel modes +O = IRCOPERATORS can only join those channels
and for user modes +O = Global IRC Operator
(I hope this is clear now!)

Both of these have no concern with the bots "O" flag still. If there is a flag named +O in the bots userfile and people with those flags are defined then its okay, otherwise not. :wink:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
M
MarlbMan
Voice
Posts: 20
Joined: Tue Apr 15, 2003 9:20 pm

Post by MarlbMan »

actually, I've made some changes and it KIND of works now. The problem I am having now however, is I cannot get it to incr correctly, I am wanting it to go to the last line, look at the first 2 characters (or bytes) and incr what it finds.(proc:vhost) Also, I need to find out how to get it to delete the line that starts with that number. (proc:reject) Here's the newest code.

Code: Select all

# vhost.tcl by MarlbMan Aug-2004 (v1.0)


set operid "vhost"
set operpass "vhost5728"
set nspass "vhost5728"
set operchan "#Administrator"
set stdchan "#militia"
bind pub -|- !vhost pub:vhost
bind pub O !approve pub:approve
bind pub O !reject pub:reject
bind pub O !pending pub:pending
bind pub O !oper pub:oper
bind pub O !ident pub:ident

proc pub:oper {nick host hand chan text} {
     global operid operpass operchan
     putserv "OPER $operid $operpass"
     putserv "PRIVMSG $operchan : Power Up!"
     }
proc pub:ident {nick host chan text} {
     global nspass operchan
     putserv "PRIVMSG NickServ : identify $nspass"
     putserv "PRIVMSG $operchan : Identified!"
     }
proc pub:vhost {nick host hand chan text} {
     global operchan
     set hostdb [open hostdb.txt a+]
     set seq [gets $hostdb 1]
     set tme [strftime %d-%m-%Y@%H:%M]
     if {$seq > 00} {incr seq 1} else {set seq 01}
     puts $hostdb "$seq $nick $text $tme"
     close $hostdb
     putserv "PRIVMSG $operchan : The user $nick has made a request for a vhost"
     putserv "PRIVMSG $operchan : Request #: $seq Requested Host: $text Time of Request: $tme"
     putserv "PRIVMSG $operchan : Please use !approve <#> to approve, or !reject <#> to reject"
     return 0
     }
proc pub:pending {nick host chan text} {
     set hostdb [open hostdb.txt r]
     set pend [read hostdb.txt]
     putserv "PRIVMSG $operchan : $pend"
     close hostdb.txt
     return 0
     }
proc pub:reject {nick host hand chan text} {
     global operchan stdchan rjct
     set hostdb [open hostdb.txt r+]
     set finished 0
     while {![eof $hostdb] && !$finished} {
     gets $hostdb line
     set rjct [lrange $line 0 end]
     set finished 1
     putlog "0"
     }
     if {$rjct !=""} {
          set rjnick [lindex $rjct 1]
          set rjhost [lindex $rjct 2]
          putserv "PRIVMSG $operchan : $rjct rejected"
          putserv "PRIVMSG $stdchan : $rjnick :Your vhost of $rjhost has been rejected"
#          puts $line "" } else { putserv "PRIVMSG $operchan :$text does not exist in my database"
          }
          return 0
          close hostdb.txt
          }
proc pub:approve {nick host chan text} {
     set hostdb [open hostdb.txt w+
     set appr ""
     set finished 0
     while {!eof $hostdb $$ !finished} {
     gets $hostdb line
     if {[lindex $line o] == $text} {
     set appr "[lrange $line 1 end]"
     set finished 1
     }
     }
     if {$appr != ""} {
          set apnick [lindex $rjct 2]
          set aphost [lindex $rjct 3]
          putserv "PRIVMSG $operchan : $appr approved"
          putserv "PRIVMSG $stdchan : $apnick : Your vhost of  $aphost has
been approved and will take effect next time you log in"
          putserv "PRIVMSG HostServ : set $apnick $aphost"
          puts $line ""
          }
          else { putserv "PRIVMSG $operchan :$text does not exist in my
database"
          }
          return 0
          close hostdb.txt
          }
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

if {$seq > 00} {incr seq 1} else {set seq 01}
To my concern this should be used as a while loop.

Code: Select all

while { #condition is true } { #do stuff } else { #do this }
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked