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 

Alert all chanops based on conditions

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
LoKii
Voice


Joined: 21 Oct 2009
Posts: 34

PostPosted: Mon Feb 25, 2013 5:20 am    Post subject: Alert all chanops based on conditions Reply with quote

Hello everyone, I'm trying to learn some basics in TCL, and I'm trying a simple code for an onjoin property but the results are not exactly what i hoped for.

What i want is, if a user with certain flags (in this case with flags +qd or |+qd $channel) joins the room, the bot should alert all channel operators (and maybe even halfops) that the user who entered is blacklisted and my not gain OPs or Voice.

The code I have here is:

Code:

bind join - * proc_blacklist

proc proc_blacklist {nick host handle channel} {
    if {[matchattr $nick +qd]} {
        foreach u [chanlist $channel] {
            if {[isop $u $channel]} {
                putserv "NOTICE $u :Warning. $nick is on my Global Blacklist and may \002NOT\002 gain OPs or VOICE on any channel that I am on!"
                return 1
            }
        }

    }
    if {[matchattr $nick |+qd $channel]} {
        foreach u [chanlist $channel] {
            if {[isop $u $channel]} {
                putserv "NOTICE $u :Warning. $nick is on my Blacklist and may \002NOT\002 gain OPs or VOICE on channel $channel!"
                return 1
            }
        }
       
    } else  {
        return 1
    }
}


If the bot is an OP on the channel, he will ONLY notice himself, however If i deop the bot (i am also OP on the chan), then the bot will notice me succesfully. However, if both of us (me and the bot) are opped, I never get the notice.

Any hints would be appreciated.

Cheers Smile[/code]
Back to top
View user's profile Send private message
dirty
Halfop


Joined: 08 Feb 2013
Posts: 40
Location: Romania

PostPosted: Mon Feb 25, 2013 6:53 am    Post subject: Reply with quote

Your error is that you stop the script that notices ops after he finds the first one..

Code:

if {[matchattr $nick |+qd $channel]} {
        foreach u [chanlist $channel] {
            if {[isop $u $channel]} {
                putserv "NOTICE $u :Warning. $nick is on my Blacklist and may \002NOT\002 gain OPs or VOICE on channel $channel!"
                return 1
            }
        }
       
    } else  {
        return 1
    }


so the right thing to do is

Code:

if {[matchattr $nick |+qd $channel]} {
        foreach u [chanlist $channel] {
            if {[isop $u $channel]} {
                putserv "NOTICE $u :Warning. $nick is on my Blacklist and may \002NOT\002 gain OPs or VOICE on channel $channel!"
            }
        }
       
    }


also i removed the else statement because it has no use
_________________
come to the dark side.. I have cookies!
WwW.BotZone.TK
Back to top
View user's profile Send private message Visit poster's website
LoKii
Voice


Joined: 21 Oct 2009
Posts: 34

PostPosted: Mon Feb 25, 2013 8:11 am    Post subject: Reply with quote

Thank you very much dirty.

This indeed solved my issue (and darn, how could i not see this) Rolling Eyes


Cheers, now I can go on with the rest Smile
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 -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
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