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 

help please flags

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


Joined: 14 Dec 2011
Posts: 16
Location: Bolivia, Beni, Trinidad / DALnet

PostPosted: Wed Dec 17, 2014 10:35 pm    Post subject: help please flags Reply with quote

this tcl lacks something so that he says (you have no privileges)

the tcl talks each other that denege the order why the common user has no privileges
and the bot makes it know like message in the channel
Code:
bind pub o|o !control control
bind pub o|o .control control

proc control {nick host hand chan text} {
global flagaccess
 if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {putquick "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0}

 puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
}

_________________
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Sedition
Voice


Joined: 14 Dec 2011
Posts: 16
Location: Bolivia, Beni, Trinidad / DALnet

PostPosted: Wed Dec 17, 2014 10:54 pm    Post subject: Re: help please flags Reply with quote

the correct thing would be

Code:
#### tcl ####
set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control

proc control {nick host hand chan text} {
global flagaccess
 if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {
   putquick "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0
 }
 puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
}

_________________
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
Back to top
View user's profile Send private message Send e-mail MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Dec 19, 2014 4:31 am    Post subject: Reply with quote

You should switch from putquick to puthelp cos if multiple members issue the same command the bot will flood itself off.

What's the point on having the onchan there? Also, instead of using return 0 you could use the if ... else ... like:
Code:

if {condition} {
   # true
} else {
   # false
}

_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Sedition
Voice


Joined: 14 Dec 2011
Posts: 16
Location: Bolivia, Beni, Trinidad / DALnet

PostPosted: Sun Jan 25, 2015 2:01 pm    Post subject: Reply with quote

ok thanks caesar
a question and putserv it is well or not to be used and not to fill of flood
Code:

set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control

proc control {nick host hand chan text} {
global flagaccess
 if {(![matchattr $hand $flagaccess $chan]) && ([onchan $nick $chan])} {
   puthelp "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)" ; return 0
 }
 puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
}

is correct caesar ?
_________________
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
Back to top
View user's profile Send private message Send e-mail MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Jan 26, 2015 8:50 am    Post subject: Reply with quote

Apart from changing from putquick to puthelp according to my recommendation, I still see the onchan and that you didn't use the if .. else .. syntax. Smile

Anyway, just to be on the safe side I've added user's throttle proc to limit the non registered users from flooding the bot to one command every 5 seconds, or how many you wish.
Code:

set flagaccess "mnofb"
bind pub - !control control
bind pub - .control control

proc control {nick uhost hand chan text} {
   global flagaccess
   if {![matchattr $hand $flagaccess $chan]} {
      if {![throttled $chan 5]} {
         puthelp "PRIVMSG $chan :\2sorry $nick :/\2 I feel it you have no privileges. =)"
      }
   } else {
      puthelp "NOTICE $chan :$nick all the commands are in wwww.tets1."
   }
}

# user's throttled
proc throttled {id seconds} {
   global throttle
   if {[info exists throttle($id)]&&$throttle($id)>[clock sec]} {
      set id 1
   } {
      set throttle($id) [expr {[clock sec]+$seconds}]
      set id 0
   }
}

bind time - ?0* throttledCleanup

proc throttledCleanup args {
   global throttle
   set now [clock sec]
   foreach {id time} [array get throttle] {
      if {$time<=$now} {unset throttle($id)}
   }
}

_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Sedition
Voice


Joined: 14 Dec 2011
Posts: 16
Location: Bolivia, Beni, Trinidad / DALnet

PostPosted: Wed Jan 28, 2015 6:13 pm    Post subject: Reply with quote

very quite thank you..
_________________
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
Back to top
View user's profile Send private message Send e-mail MSN Messenger
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