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.

Having Difficulty With This Script I Wrote.

Old posts that have not been replied to for several years.
Locked
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Having Difficulty With This Script I Wrote.

Post by CoMMy »

This Script, what it does basically, is check the modes of the channel and see if the change is made by unathrorized users and set them back.

Code: Select all

#Mode Protection
bind mode - * modes

proc modes {nick uhost hand chan mode victim} {
global botnick owner

if {$nick == "$botnick"} { return 0 }

if {![isop $botnick $chan]} {
putquick "PRIVMSG X :op $chan" -next
if {[file exists netbots/getops.tcl] || [file exists scripts/getops.tcl]} {
set bot [getbot $chan]
putbot $bot "gop op $chan $botnick" }}

if {$mode == "-o" && [isbotnick $victim]} {
if {![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "PRIVMSG X :op $chan" -next
pushmode $chan -o-v+b $nick $nick [nick2hand $nick $chan]
putquick "KICK $chan $nick Dont Ever Deop Me" -next }

if {$mode == "-o" && [ischanset $chan protectops]} {
if {![matchattr [nick2hand $nick $chan] o]} {continue}
if {[isop $victim $chan]} {
putquick "MODE $chan -o-v+o+b $nick $nick $victim [nick2hand $nick $chan]" -next
putquick "KICK $chan $nick Operators Are Protected." -next }}

if {$mode == "-o" && [ischanset $chan protectusers]} {
if {![matchattr [nick2hand $nick $chan] o]} {continue}
if {[matchattr [nick2hand $victim $chan] &o $chan] || [matchattr [nick2hand $victim $chan] o]} {
putquick "MODE $chan -o-v+o+b $nick $nick $victim [nick2hand $nick $chan]" -next
putquick "KICK $chan $nick Users Are Protected." -next }}

if {$mode == "-v" && [ischanset $chan protectvoice]} {
if {![matchattr [nick2hand $nick $chan] o]} {continue}
if {[isvoice $victim $chan]} {
putquick "MODE $chan -o-v+v $nick $nick $victim" -next
putnotc $nick "Voiced Users Are Protected In Chan." }}

if {$mode == "+b" && [ischanset $chan protectusers]} {
if {![matchattr [nick2hand $nick $chan] &o $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
if {[matchattr $victim &o $chan] || [matchattr $victim o]} {
putquick "MODE $chan -b-o-v+b $victim $nick $nick [nick2hand $nick $chan]" -next
putquick "KICK $chan $nick Users Are Protected." -next }}

if {$mode == "+i" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &m $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "MODE $chan -i" -next
putquick "MODE $chan -o-v $nick $nick" -next
putquick "KICK $chan $nick You Have No Access To Set +i" -next }

if {$mode == "-i" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &m $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "MODE $chan +i" -next
putquick "MODE $chan -o-v $nick $nick" -next
putquick "KICK $chan $nick You Have No Access To Set -i" -next }

if {$mode == "+s" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &o $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "MODE $chan -s" -next
putquick "MODE $chan -o-v $nick $nick" -next
putnotc $nick "Sorry But You Dont Have Access To Set The Channel To +s" }

if {$mode == "-s" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &o $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "MODE $chan +s" -next
putquick "MODE $chan -o-v $nick $nick" -next
putnotc $nick "Sorry But You Dont Have Access To Set The Channel To -s" }

if {$mode == "+p" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &o $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "MODE $chan -p" -next
putquick "MODE $chan -o-v $nick $nick" -next
putnotc $nick "Sorry But You Dont Have Access To Set The Channel To +p" }

if {$mode == "-p" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &o $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "MODE $chan +p" -next
putquick "MODE $chan -o-v $nick $nick" -next
putnotc $nick "Sorry But You Dont Have Access To Set The Channel To -p" }

if {$mode == "+k *" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &n $chan] || ![matchattr [nick2hand $nick $chan] m]} {continue}
set what [lindex $mode 1]
putquick "MODE $chan -k $what" -next
putquick "MODE $chan -o-v $nick $nick" -next
putnotc $nick "Sorry But You Dont Have Access To Set The Channel To +k" }

if {$mode == "+m" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &o $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "MODE $chan -m" -next
putquick "MODE $chan -o-v $nick $nick" -next
putnotc $nick "Sorry But You Dont Have Access To Set The Channel To +m" }

if {$mode == "-m" && [ischanset $chan protectchan]} {
if {![matchattr [nick2hand $nick $chan] &o $chan] || ![matchattr [nick2hand $nick $chan] o]} {continue}
putquick "MODE $chan +m" -next
putquick "MODE $chan -o-v $nick $nick" -next
putnotc $nick "Sorry But You Dont Have Access To Set The Channel To -m" }

return 1 }
#Mode Protection
The Error i get is this:
Tcl error [modes]: invoked "continue" outside of a loop
Can you help me please.
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

"continue" is a command used to skip to the next iteration of a loop...
You have no loop... As such, I suspect you meant to use "return" ?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Instead of lots of if's why don't you just use "switch" ?
Once the game is over, the king and the pawn go back in the same box.
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

I dont know how to apply switch.

Can you demonstrate for the first 2 commands please ?
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

if {![isop $botnick $chan]} {
should be

Code: Select all

if {![botisop $chan]} {

Code: Select all

switch -- $mode {
"-o" {
# your stuff here
}
"+b" {
# your stuff here
}
}
as for the
ischanset $chan yourflag
wich I guess is a proc that check for a channel flag use
the built in
channel get $chan yourflag
Once the game is over, the king and the pawn go back in the same box.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

caesar wrote:

Code: Select all

if {![isop $botnick $chan]} {
should be

Code: Select all

if {![botisop $chan]} {
"botisop" is not compatible across all eggdrop versions....
"isop" of course, is compatible... Thus.... I agree with his usage of "isop"...
caesar wrote:

Code: Select all

channel get $chan yourflag
Again, another command which isn't even compatible throughout the entire 1.6.x eggdrop branch (go figure..)...

Checking against "channel info" would be most recommended.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I wonder who still uses old versions of eggdrop and not at least an 1.6.9.. :P
Once the game is over, the king and the pawn go back in the same box.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

caesar wrote:I wonder who still uses old versions of eggdrop and not at least an 1.6.9.. :P
I for one... and I know many many more who still use older versions.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Liar! :mrgreen:
Once the game is over, the king and the pawn go back in the same box.
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

I still use 1.6.12 ::PPPPPPP

Go figure.
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

CoMMy wrote: I still use 1.6.12 ::PPPPPPP
Go figure.
huh? :mrgreen: strikelight was talking about the fact that in some older versions of eggdrop the changes I have suggested are not "valid" but in your case if you use an 1.6.12 then it's ok to do the changes, if you wish ofcource. :mrgreen:
Once the game is over, the king and the pawn go back in the same box.
Locked