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.

Op with password script not working

Old posts that have not been replied to for several years.
E
Eternal Bliss
Voice
Posts: 20
Joined: Wed Jun 18, 2003 12:01 pm

Op with password script not working

Post by Eternal Bliss »

I tried making a script that will give op to a user when he pm's the egg with a password... and it keeps giving him bad password.
the nick always starts with '^`' and the channel is always with '^`' in the start.
this is the code i wrote, what seems to be wrong?
I don't mind NOT having the nick auth checking, as long as the password will work.

Code: Select all

set password "test"
set users "^`"
set chan "#^`lqjre"

bind msgm - * premsg

proc premsg {nick host hand text} {
  global password users chan

    set first [lindex $text 0]
      set second [lindex $text 1]
        if {$password == "$second"} {
            if {![string match -nocase "*$first*" $users]} { return 0 } else {
                   putlog "-V- User $nick is being opped @ $chan"
                          putserv "mode $chan +o $nick"
                                 putserv "NOTICE $nick :You're now opped on $chan!"
                                     }
                                       } else {
                                              putlog "-Error- user: $nick typed WRONG password ($second)"
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

close the brace } at the end of the code.
E
Eternal Bliss
Voice
Posts: 20
Joined: Wed Jun 18, 2003 12:01 pm

Post by Eternal Bliss »

Sorry, forgot to paste that :D

Code: Select all

set password "test"
set users "^`"
set chan "#^`lqjre"

bind msgm - * premsg

proc premsg {nick host hand text} {
  global password users chan

    set first [lindex $text 0]
      set second [lindex $text 1]
        if {$password == "$second"} {
            if {![string match -nocase "*$first*" $users]} { return 0 } else {
                   putlog "-V- User $nick is being opped @ $chan"
                          putserv "mode $chan +o $nick"
                                 putserv "NOTICE $nick :You're now opped on $chan!"
                                     }
                                       } else {
                                              putlog "-Error- user: $nick typed WRONG password ($second)"
}
}
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

try this:

Code: Select all

set password "test" 
set users "^`" 
set chan "#^`lqjre"

bind msgm - * premsg 

proc premsg {nick host hand text} { 
  global password users chan 

    set first [lindex $text 0] 
      set second [lindex $text 1] 
        if {$second == $password} { 
            if {![string match -nocase "*$first*" $users]} { return 0 } 
        putlog "-V- User $nick is being opped @ $chan" 
        putserv "mode $chan +o $nick" 
        putserv "NOTICE $nick :You're now opped on $chan!" 
}
 else { 
    putlog "-Error- user: $nick typed WRONG password ($second)" 
    } 
}
E
Eternal Bliss
Voice
Posts: 20
Joined: Wed Jun 18, 2003 12:01 pm

Post by Eternal Bliss »

[18:04] Tcl error [premsg]: invalid command name "else"
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Instead of this:

Code: Select all

  } 
  else {
make it:

Code: Select all

  } else {
Once the game is over, the king and the pawn go back in the same box.
E
Eternal Bliss
Voice
Posts: 20
Joined: Wed Jun 18, 2003 12:01 pm

Post by Eternal Bliss »

[19:48] -Error- user: EB typed WRONG password ()
[19:48] [EB!eternal-bl@7029B6E.EA98ECBE.69A161A6.IP] test
that is my problem ;/
i changed the vars to this:

Code: Select all

set password "test"
set users "EB"
set chan "#^`lqjre"
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

you are only msg'ing the bot "test".

try "EB test"

also, you should split text to prevent lindex confusion
photon?
E
Eternal Bliss
Voice
Posts: 20
Joined: Wed Jun 18, 2003 12:01 pm

Post by Eternal Bliss »

lol, thanks! :)
E
Eternal Bliss
Voice
Posts: 20
Joined: Wed Jun 18, 2003 12:01 pm

Post by Eternal Bliss »

Another problem :(
those are the vars set:

Code: Select all

set password "test"
set users "^`bj"
set chan "#^`lqjre"
[15:57] [^`bj!my@7029B6E.EA98ECBE.69A161A6.IP] בי: test
[15:58] -Error- user: ^`bybj{ typed WRONG password ()
How can i change the code so it will check the nickname and not the first letter?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

try this:

Code: Select all

set password "test" 
set users "^`bj" 
set chan "#^`lqjre" 

bind msgm - * premsg 

proc premsg {nick host hand text} { 
  global password users chan 

    set first [lindex $text 0] 
        if {$first == $password} { 
           if {![string match -nocase $nick "$users*"]} {return 0} 
        putlog "-V- User $nick is being opped @ $chan" 
        putserv "mode $chan +o $nick" 
        putserv "NOTICE $nick :You're now opped on $chan!" 
} else { 
    putlog "-Error- user: $nick typed WRONG password ($first)" 
    } 
}
E
Eternal Bliss
Voice
Posts: 20
Joined: Wed Jun 18, 2003 12:01 pm

Post by Eternal Bliss »

[21:37] -Error- user: ^`bj typed WRONG password (ßΘ:átest)
[21:37] [^`bj!my@7029B6E.EA98ECBE.69A161A6.IP] ßΘ:átest
;/
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

beats me :-?
E
Eternal Bliss
Voice
Posts: 20
Joined: Wed Jun 18, 2003 12:01 pm

Post by Eternal Bliss »

Umm, maybe if the bot will check if the password is found in the PM then op him?
this way he will ignore anything else...
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

[21:37] -Error- user: ^`bj typed WRONG password (ßΘ:átest)
[21:37] [^`bj!my@7029B6E.EA98ECBE.69A161A6.IP] ßΘ:átest
Where are those extra chars coming from? ßΘ Obviously those are screwing up the password check heh. Do you have some script that adds goofy chars like that when you type something?
Locked