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 with this simple script

Old posts that have not been replied to for several years.
Locked
User avatar
mrdr
Halfop
Posts: 42
Joined: Thu Jun 16, 2005 2:20 pm
Location: Lithuania / Vilnius / Underground
Contact:

need some help with this simple script

Post by mrdr »

Hey,

I'm sure that you know what this script does. ;)
And I want to make that when I write "deop" or "devoice" I don't need to write "devoice <my nick>" or "deop <my nick>"
I think it's smth like "if {[$tnick == $me]}" or smth... I don't know. :D
Here is the code:

Code: Select all

bind pub o deop pub:op
proc pub:op {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[isop $tnick $chan]} { pushmode $chan -o $tnick } 
      } else { puthelp "NOTICE $nick :Tokio nicko kanale nera!" }
    } else { puthelp "NOTICE $nick :Naudojimas: deop <nick>" }
  } else { puthelp "NOTICE $nick :As neturiu opo!" }
}

bind pub o devoice pub:dv
proc pub:dv {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[isop $tnick $chan]} { pushmode $chan -v $tnick } 
      } else { puthelp "NOTICE $nick :Tokio nicko kanale nera!" }
    } else { puthelp "NOTICE $nick :Naudojimas: devoice <nick>" }
  } else { puthelp "NOTICE $nick :As neturiu opo!" }
}

putlog "*** test.tcl - LOADED!"
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

firstly:

Code: Select all

if {[string length $text] > 0} { 
is incorrect, use

Code: Select all

if {[llength $text] >= 1} { set tnick [lindex [split $text] 0]

Code: Select all

set tnick [lindex $text 0]
should be

Code: Select all

set tnick [lindex [split $text] 0]
And are you saying if you type deop or devoice without any nick, you want the bot to deop/devoice yourself?

if yes:

Code: Select all

if {($text == "") || ([llength $text] == 0) } {
set tnick $nick
blah
}
Also

Code: Select all

if {[isop $tnick $chan]} { pushmode $chan -v $tnick } 
should be

Code: Select all

if {[isvoice $tnick $chan]} { pushmode $chan -v $tnick } 
Also, im so tired, i may have missed something or did something wrong. Just warning you ;p. Hope it works!!
r0t3n @ #r0t3n @ Quakenet
User avatar
mrdr
Halfop
Posts: 42
Joined: Thu Jun 16, 2005 2:20 pm
Location: Lithuania / Vilnius / Underground
Contact:

Post by mrdr »

I'm sure that you're tired, I'm too. I will die with my rollerblades. :lol:

Well your script don't work. Or I made mistakes AGAIN. :)
Here's the code:

Code: Select all

bind pub o deop pub:op
proc pub:op {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
     if {[llength $text] >= 1} { set tnick [lindex [split $text] 0]
      set tnick [lindex [split $text] 0]
      if {[onchan $tnick $chan]} {
        if {[isop $tnick $chan]} { pushmode $chan -o $tnick } 
      } else { puthelp "NOTICE $nick :No such nick!" }
    } else { puthelp "NOTICE $nick :Usage: deop <nick>" }
  } else { puthelp "NOTICE $nick :I don't have ops!" }
 }
}

bind pub o devoice pub:dv
proc pub:dv {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[llength $text] >= 1} { set tnick [lindex [split $text] 0]
      set tnick [lindex [split $text] 0]
      if {[onchan $tnick $chan]} {
        if {[isvoice $tnick $chan]} { pushmode $chan -v $tnick }
      } else { puthelp "NOTICE $nick :No such nick!" }
    } else { puthelp "NOTICE $nick :Usage: devoice <nick>" }
  } else { puthelp "NOTICE $nick :I don't have ops!" }
}

putlog "*** test.tcl - LOADED!"
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Code: Select all

bind pub o|o !deop pub:op 
proc pub:op {nick uhost hand chan text} { 
  if {![botisop $chan]} {
    putserv "NOTICE $nick :Im not oped on $chan."
    return 0
  } 
  if {![llength $text] >= 1} {
    putserv "NOTICE $nick :Please enter a nick to deop."
    } else {
    set tnick [lindex [split $text] 0]
    if {![onchan $tnick $chan]} { 
      putserv "NOTICE $nick :$tnick is not on $chan."
      return 0
    }
    if {![isop $tnick $chan]} {
      putserv "NOTICE $nick :$tnick is not oped on $chan."
      } else {
      pushmode $chan -o $tnick 
    } 
  }
}
     
bind pub o|o !devoice pub:dv 
proc pub:dv {nick uhost hand chan text} {
  if {![botisop $chan]} {
    putserv "NOTICE $nick :Im not oped on $chan."
    return 0
  } 
  if {![llength $text] >= 1} {
    putserv "NOTICE $nick :Please enter a nick to devoice."
    } else {
    set tnick [lindex [split $text] 0]
    if {![onchan $tnick $chan]} { 
      putserv "NOTICE $nick :$tnick is not on $chan."
      return 0
    }
    if {![isvoice $tnick $chan]} {
      putserv "NOTICE $nick :$tnick is not voiced on $chan."
      } else {
      pushmode $chan -v $tnick 
    } 
  }
} 
  
putlog "*** test.tcl - LOADED!"
Try that...
r0t3n @ #r0t3n @ Quakenet
User avatar
mrdr
Halfop
Posts: 42
Joined: Thu Jun 16, 2005 2:20 pm
Location: Lithuania / Vilnius / Underground
Contact:

Post by mrdr »

Well...
(03:16:56) (@mrdr) !devoice
(03:16:57)  ›› [ egghelp (~buy@weed.lt) ] Please enter a nick to devoice.
(03:17:06) (@mrdr) !deop
(03:17:06)  ›› [ egghelp (~buy@weed.lt) ] Please enter a nick to deop.

I want when I write !deop bot deops me. :|
If I write nick after !deop bot will deop that nick.
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

mrdr wrote: I want when I write !deop bot deops me. :|
If I write nick after !deop bot will deop that nick.

Code: Select all

proc pub:deop {nick uhost hand chan text} {
   set who [lindex [split $text] 0] ;# who to deop?
   if {$who == ""} {                ;# no argument given, deop command's issuer
      if [isop $nick $chan] {pushmode $chan -o $nick}
   } else {                         ;# deop $who
      if [isop $who $chan] {pushmode $chan -o $who}
   }
}
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

public kick/mode commands are lame anyway
D
Decl
Voice
Posts: 26
Joined: Thu Jul 14, 2005 1:50 am
Location: Tartu, Estonia
Contact:

Post by Decl »

See the LoL's Toolz :p quite useful commands there, plus !op & !deop work without entering a nickname.
Contact: [CB]Decl @ #ClanBase (QuakeNet)
www.clanbaseradio.com
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

mrdr wrote:I want when I write !deop bot deops me. :|
If I write nick after !deop bot will deop that nick.
Try FzCommands.
User avatar
mrdr
Halfop
Posts: 42
Joined: Thu Jun 16, 2005 2:20 pm
Location: Lithuania / Vilnius / Underground
Contact:

Post by mrdr »

Sir_Fz wrote:
mrdr wrote:I want when I write !deop bot deops me. :|
If I write nick after !deop bot will deop that nick.
Try FzCommands.
Thank You, nice script. :mrgreen:
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Code: Select all

if {($text == "") || ([llength $text] == 0) } { 
These are the exact same, why would you be checking them both?
Locked