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 for only specified nicks

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
w
whoelse
Voice
Posts: 15
Joined: Mon Oct 08, 2007 6:45 pm

OP for only specified nicks

Post by whoelse »

I want to have a script that bot will allow to get opped only specified nicks
like on one file.txt I will save aop list of the channel and sop list. if anyone from ops changes nick, automatically gets deopped or if he/she is trying to get opped though someone else nickname, bot won't allow and will automatically deop.
a talent can win a game, teamwork wins championchip!
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Code: Select all

### Set your ops nickname here.
set oplist { "nickname1" "nickname2" "nickname3" "nickname4" }


### Set your channel.
set opchan "#cricketops"

### Do not edit from here.

bind pub - !op op:user
bind nick - * nickchange

proc op:user {nick host handle chan text} { 
global oplist opchan temp
if {(([lsearch -exact [string tolower $opchan] [string tolower $chan]] != -1)  || ($opchan == ""))} {
  set temp 0
	foreach i [string tolower $oplist] {
	if {[string match *$i* [string tolower $nick]]} {
	set temp 1
 	}
 	}
}
	if {!$temp} { return } {
putquick "MODE $opchan +o $nick"
 } 
}

proc nickchange {nick uhost hand chan newnick} {
 global oplist opchan botnick 
if {![isop $newnick $opchan]} { return }
if {(![matchattr $hand b]) && ($nick != $botnick)} {
  foreach badchange [string tolower $oplist] {
   if {![string match *$badchange* [string tolower $newnick]]} {
    putserv "MODE $opchan -o $newnick"
    putserv "PRIVMSG $newnick :You're deoped because your new nickname is not in my list, contact my administrator for more."
    return 0
    }  
  }
 }
}

bind mode - * mode_proc
proc mode_proc {nick host hand chan modechg victim} {
global oplist opchan botnick
if {($victim == $botnick) || ($nick == $botnick)} { return }
if { $modechg == "+o" } {
  foreach badop [string tolower $oplist] {
   if {[string match *$badop* [string tolower $victim]]} { return }
    putserv "MODE $opchan -o $victim"
    putserv "PRIVMSG $victim :You're deoped because your new nickname is not in my list, contact my administrator for more."
    return 0
  }
}
}


putlog "Op users in the list TCL loaded."

Ok, I have edited and modified one tcl by RanaUsman so the credit should go to him mostly. 2ndly, this script is not tested I have currently just added !op feature for those who are in the list, tell me if it is working then I will add more features what you have asked for. Let me know if it's working or if not then what is the error.

After completing this script I was searching Archive I have

THIS

You should also take a look into it and for next time please search the Archive before posting here. :D


Thanks
iamdeath

Edit: I haved added, if the person is oped by someone else and he is not in the list he will be deoped right away, if the person changes nickname and that new nickname is not in the list will be deoped right away, if somoene trys !op will get op only if he has nickname added in the bots list.
So now let me know what else can I do for you.


Edit: Fixed, list bug. Thanks to nml.
Edit: Well I have changed it a bit give it a try.
Last edited by iamdeath on Sat Oct 13, 2007 8:09 am, edited 3 times in total.
|AmDeAtH @ Undernet
Death is only the *Beginning*...
w
whoelse
Voice
Posts: 15
Joined: Mon Oct 08, 2007 6:45 pm

Post by whoelse »

actually I don't need AUTO OP script. AOP-s will get op themself, I just don't want them to change nicks and I don't want the bot let them stay with op if they change nick or if they join chat with another nickname and identify to their "access nick" to get opped. I hope you get what I want :)
a talent can win a game, teamwork wins championchip!
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

That is exactly what i have made for you, op with a pub command !op those whose nicknames are in the list and if they change nickname they will be deoped right away. That isn't autoop and yes the other script has auto op feature not the one I have presented to you.
|AmDeAtH @ Undernet
Death is only the *Beginning*...
w
whoelse
Voice
Posts: 15
Joined: Mon Oct 08, 2007 6:45 pm

Post by whoelse »

iamdeath wrote:That is exactly what i have made for you, op with a pub command !op those whose nicknames are in the list and if they change nickname they will be deoped right away. That isn't autoop and yes the other script has auto op feature not the one I have presented to you.
Thank you very much for helping me.
You didn't get my last line
I might have to add on this script also

Code: Select all

bind mode - *+o*
when the nick is opped by chanserv bot will check if the opped nick is on the list, if the nick isn't, the bot should deop him immediately.He she wont get OPPED until he/she joins with his nick...
a talent can win a game, teamwork wins championchip!
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Ok check now the script and let me if that is what you wanted and if it's working fine with you.

Peace
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
w
whoelse
Voice
Posts: 15
Joined: Mon Oct 08, 2007 6:45 pm

Post by whoelse »

iamdeath wrote:Ok check now the script and let me if that is what you wanted and if it's working fine with you.

Peace
iamdeath

Code: Select all

[22:53] Tcl error [nickchange]: unmatched open quote in list
[22:53] Tcl error [nickchange]: unmatched open quote in list
[22:53] Tcl error [nickchange]: unmatched open quote in list
this is what I get when someone changes his/her nick.
a talent can win a game, teamwork wins championchip!
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

script is working fine with me, check your script that if you have copied it properly.
|AmDeAtH @ Undernet
Death is only the *Beginning*...
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

The error is mainly in the oplist "list".
If this variable does not hold a valid list structure, the rest of the script will fail with similar error messages such as those posted.

Also, it is unadvisable to use string commands (such as "string tolower") on lists. If you need non-case sensitive matching, considder using -nocase options with "string match" (and other functions for comparsion that also supports it).
On a second thought, do you really wish to use string match at all, should'nt it me "string equal". After all, it says list of nicks, not list of nick-patterns...
NML_375
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

nml375 wrote:The error is mainly in the oplist "list".
If this variable does not hold a valid list structure, the rest of the script will fail with similar error messages such as those posted.

Also, it is unadvisable to use string commands (such as "string tolower") on lists. If you need non-case sensitive matching, considder using -nocase options with "string match" (and other functions for comparsion that also supports it).
On a second thought, do you really wish to use string match at all, should'nt it me "string equal". After all, it says list of nicks, not list of nick-patterns...
but the script is working fine for me thats kinda strange ;/
|AmDeAtH @ Undernet
Death is only the *Beginning*...
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@iamdeath:
The reason it works for you, is that you've been careful, or rather lucky, enough when creating your oplist "list".

The prefer'd way of creating lists is by using the list command, having the list-items each as a separate argument:

Code: Select all

set mylist [list "item 1" "item2" "item3" ...]
For very long lists, structures such as this may be used:

Code: Select all

set mylist [list "item 1" \
"item2" \
"item3 \
...
"item N"]
NML_375
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

nml375 wrote:@iamdeath:
The reason it works for you, is that you've been careful, or rather lucky, enough when creating your oplist "list".

The prefer'd way of creating lists is by using the list command, having the list-items each as a separate argument:

Code: Select all

set mylist [list "item 1" "item2" "item3" ...]
For very long lists, structures such as this may be used:

Code: Select all

set mylist [list "item 1" \
"item2" \
"item3 \
...
"item N"]
Thanks alot nml for correcting me, you've been soo kind and helpful always and been the best way to learn TCL scripting.
whoelse wrote:
iamdeath wrote:Ok check now the script and let me if that is what you wanted and if it's working fine with you.

Peace
iamdeath

Code: Select all

[22:53] Tcl error [nickchange]: unmatched open quote in list
[22:53] Tcl error [nickchange]: unmatched open quote in list
[22:53] Tcl error [nickchange]: unmatched open quote in list
this is what I get when someone changes his/her nick.
Ok I have fixed it now you may retry.

Thank you
|AmDeAtH @ Undernet
Death is only the *Beginning*...
w
whoelse
Voice
Posts: 15
Joined: Mon Oct 08, 2007 6:45 pm

Post by whoelse »

I have no error's this time, but script doesn't let no one get opped, also those who are on the list, have another bug... when normal users change their nick they receive message from the bot like they "have been deopped" ...
a talent can win a game, teamwork wins championchip!
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

whoelse wrote:I have no error's this time, but script doesn't let no one get opped, also those who are on the list, have another bug... when normal users change their nick they receive message from the bot like they "have been deopped" ...
Show me exactly what code you're using please, don't copy paste mine, show me exactly yours.
|AmDeAtH @ Undernet
Death is only the *Beginning*...
w
whoelse
Voice
Posts: 15
Joined: Mon Oct 08, 2007 6:45 pm

Post by whoelse »

Code: Select all

#set your ops nickname here.
set oplist [list "nick1" "nick2" "nick3" "nick4" "nick5" "nick6" "nick7" "nick8" "nick9" "nick10" "nick11" ]

### Set your channel.
set opchan "#tmp"

### Do not edit from here.

bind nick - * nickchange

proc nickchange {nick uhost hand chan newnick} {
 global oplist opchan botnick
 if {(![matchattr $hand b]) && ($nick != $botnick)} {
   foreach badchange [string tolower $oplist] {
  if {![string match *$badchange* [string tolower $newnick]]} {
      putserv "MODE $opchan -o $newnick"
  return 0
      }
}
 }
}

bind mode - * mode_proc
proc mode_proc {nick host hand chan modechg victim} {
 global oplist opchan botnick
 if {($victim == $botnick) || ($nick == $botnick)} { return }
 if { $modechg == "+o" } {
  foreach badop [string tolower $oplist] {
  if {[string match *$badop* [string tolower $victim]]} { return }
  putserv "MODE $opchan -o $victim"
  putserv "PRIVMSG $victim :You're deoped because your new nickname is not in my list, contact my administrator for more"
  return 0
}
    }
}

I've just removed the "!op" command as I have no need of it...
a talent can win a game, teamwork wins championchip!
Post Reply