egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

OP for only specified nicks
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
whoelse
Voice


Joined: 08 Oct 2007
Posts: 15

PostPosted: Thu Oct 11, 2007 2:37 am    Post subject: OP for only specified nicks Reply with quote

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!
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Thu Oct 11, 2007 4:12 am    Post subject: Reply with quote

Code:
### 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. Very Happy


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.
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...


Last edited by iamdeath on Sat Oct 13, 2007 8:09 am; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website
whoelse
Voice


Joined: 08 Oct 2007
Posts: 15

PostPosted: Thu Oct 11, 2007 6:11 am    Post subject: Reply with quote

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 Smile
_________________
a talent can win a game, teamwork wins championchip!
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Thu Oct 11, 2007 8:21 am    Post subject: Reply with quote

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*...
Back to top
View user's profile Send private message Visit poster's website
whoelse
Voice


Joined: 08 Oct 2007
Posts: 15

PostPosted: Thu Oct 11, 2007 12:35 pm    Post subject: Reply with quote

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:
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!
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Thu Oct 11, 2007 4:15 pm    Post subject: Reply with quote

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*...
Back to top
View user's profile Send private message Visit poster's website
whoelse
Voice


Joined: 08 Oct 2007
Posts: 15

PostPosted: Thu Oct 11, 2007 4:53 pm    Post subject: Reply with quote

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:
[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!
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Oct 12, 2007 12:29 am    Post subject: Reply with quote

script is working fine with me, check your script that if you have copied it properly.
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Oct 12, 2007 9:07 am    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Oct 12, 2007 11:42 am    Post subject: Reply with quote

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*...
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Oct 12, 2007 12:52 pm    Post subject: Reply with quote

@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:
set mylist [list "item 1" "item2" "item3" ...]


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

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Sat Oct 13, 2007 4:09 am    Post subject: Reply with quote

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:
set mylist [list "item 1" "item2" "item3" ...]


For very long lists, structures such as this may be used:
Code:
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:
[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*...
Back to top
View user's profile Send private message Visit poster's website
whoelse
Voice


Joined: 08 Oct 2007
Posts: 15

PostPosted: Sat Oct 13, 2007 5:10 am    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Sat Oct 13, 2007 5:26 am    Post subject: Reply with quote

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*...
Back to top
View user's profile Send private message Visit poster's website
whoelse
Voice


Joined: 08 Oct 2007
Posts: 15

PostPosted: Sat Oct 13, 2007 5:42 am    Post subject: Reply with quote

Code:
#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!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber