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.

Some help addop delop

Help for those learning Tcl or writing their own scripts.
Post Reply
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Some help addop delop

Post by blake »

Hey found this bit of code by nml for addop has a small error

Tcl error [msg:addop]: missing "

Also how can i go about adding delop to this, addop needs to be global so basicaly will need to do adduser nick then chattr handle +flags


Code: Select all

bind msg SA addop cmd:addop

proc cmd:addop {nick host hand text} {
 if {![validuser $hand]} {
  set hand [string range $nick 0 8]
  if {![validuser $hand]} {
   adduser [string range $nick 0 8] [maskhost "${nick}!${host}]
  } else {
   puthelp "PRIVMSG $nick :Unable to register new handle"
   return 1
  }
 }
 chattr $hand "+ho"
}
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Minor typo in there.

Code: Select all

proc cmd:addop {nick host hand text} {
 if {![validuser $hand]} {
  set hand [string range $nick 0 8]
  if {![validuser $hand]} {
   adduser [string range $nick 0 8] [maskhost "${nick}!${host}"]
  } else {
   puthelp "PRIVMSG $nick :Unable to register new handle"
   return 1
  }
 }
 chattr $hand "+ho"
}
For "delete op", reverse logic and use deluser to remove the user record, or chattr to remove the flags (deluser shown below):

Code: Select all

bind msg ho delop cmd:delop
proc cmd:delop {nick host hand text} {
 if {[validuser $hand]} {
  deluser $hand
 }
}
Chattr version:

Code: Select all

bind msg ho delop cmd:delop
proc cmd:delop {nick host hand text} {
 if {[validuser $hand]} {
  chattr $hand "-ho"
 }
}
NML_375
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

addop dont seem to work when i do addop nickname
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

This script was written to add the user him/herself, not someone else.
NML_375
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Ah i see i want it so +SA users can add delop
Post Reply