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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
cache
Master
Posts: 306 Joined: Tue Jan 10, 2006 4:59 am
Location: Mass
Post
by cache » Wed May 07, 2008 7:10 am
am trying to make a command only work by my nickname
I did this but no results or errors
Code: Select all
set 123owner "cache"
set 123activatecmd "!test"
proc proc_thisatest {nick uhost hand cmd} {
if {[string tolower $command] == [string tolower $123activatecmd]} {
if {[string tolower $nick] == [string tolower $123owner]} {
putquick "PRIVMSG $chan :xx blah"
} else {
putquick "NOTICE $nick :Only $132owner can use this command."
}
}
}
Does anyone have one I can edit? I do want to make one that can work by 2 nicks.
Thanks
DragnLord
Owner
Posts: 711 Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA
Post
by DragnLord » Wed May 07, 2008 11:31 am
cache wrote: am trying to make a command only work by my nickname
I did this but no results or errors
Code: Select all
set 123owner "cache"
set 123activatecmd "!test"
proc proc_thisatest {nick uhost hand cmd} {
if {[string tolower $command] == [string tolower $123activatecmd]} {
if {[string tolower $nick] == [string tolower $123owner]} {
putquick "PRIVMSG $chan :xx blah"
} else {
putquick "NOTICE $nick :Only $132owner can use this command."
}
}
}
Does anyone have one I can edit? I do want to make one that can work by 2 nicks.
Thanks
This is why eggdrop has user flags.
Set the user flag "9" [example: .chattr cache 9] to who you want to be able to use the command and set that also in the bind.
Code: Select all
bind msg 9 $123activatecmd proc_thisatest
The bind has to come after the sets.
DragnLord
Owner
Posts: 711 Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA
Post
by DragnLord » Wed May 07, 2008 11:37 am
Code: Select all
set 123activatecmd "!test"
bind pub 9 $123activatecmd proc_thisatest
proc proc_thisatest {nick uhost hand chan text} {
putquick "PRIVMSG $chan :xx blah"
}
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Wed May 07, 2008 12:15 pm
...unless he/she want to showoff by doing the command and have everyone else try it aswell
..and then you have to tell them that they cannot offcourse
Code: Select all
set 123owner "cache nick2"
set 123activatecmd "!test"
bind pub - $123activatecmd proc_thisatest
proc proc_thisatest {nick uhost hand chan text} {
if {[lsearch [list $::123owner] $nick ] != -1} {
putquick "PRIVMSG $chan :xx blah"
} else {
set niceoutputthingie [join [split $::132owner] " and "]
putquick "NOTICE $nick :Only $niceoutputthingie can use this command."
}
}
would not recommend this method though, atleast to execute any "dangerous" commands, anyone stealing your nick would be able to execute it..
Elen sila lúmenn' omentielvo
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Wed May 07, 2008 1:27 pm
Papillon:
That code is unfortunately flawed, as the list you search using lsearch contains one single item, being the full content of ::123owner. Were you thinking of using split perhaps?
=====
I would advocate the use of user-records and flags, and replace the test with something like this:
Code: Select all
if {[matchattr $hand 9|9 $chan]} {...
In this case, the binding would be similar to that one posted by DragnLord, except the flag would be - instead of 9.
NML_375
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Wed May 07, 2008 1:34 pm
it's 3-4 years since the last time i touched anything with tcl so I'm abit "rusty"... yes, I was thinking about split, thought I'd added it
as said in the last post, I recommend using user-flags instead of nick-matching along with nml375 and DragnLord
Elen sila lúmenn' omentielvo
cache
Master
Posts: 306 Joined: Tue Jan 10, 2006 4:59 am
Location: Mass
Post
by cache » Wed May 07, 2008 2:10 pm
DragnLord wrote: Code: Select all
set 123activatecmd "!test"
bind pub 9 $123activatecmd proc_thisatest
proc proc_thisatest {nick uhost hand chan text} {
putquick "PRIVMSG $chan :xx blah"
}
Thanks for the input, im trying to do this without having to setup a flag in the bot, so I see I left off pub -|- somewhere
cache
Master
Posts: 306 Joined: Tue Jan 10, 2006 4:59 am
Location: Mass
Post
by cache » Wed May 07, 2008 2:42 pm
nml375 wrote: Papillon:
That code is unfortunately flawed, as the list you search using lsearch contains one single item, being the full content of ::123owner. Were you thinking of using split perhaps?
=====
I would advocate the use of user-records and flags, and replace the test with something like this:
Code: Select all
if {[matchattr $hand 9|9 $chan]} {...
In this case, the binding would be similar to that one posted by DragnLord, except the flag would be - instead of 9.
Not for anything dangerous/excutable so I am just doing this without flags