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.

Need Help With A Public CMD.

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

Need Help With A Public CMD.

Post by CoMMy »

Hi, I need help again please. Can Anyone tell me how to make The bot
stop accepting the !rules cmd after The command was issued
3 times in 10seconds?


This is the code that needs changing.

Code: Select all

bind pub - !rules pub_rules

proc pub_rules { nick host hand chan testes} {
putserv "Notice $nick :Rule 1.."
putserv "Notice $nick :Rule 2.."
putserv "Notice $nick :etc...."
return 1 }
Please Help.
Thanks.
(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 »

This should do the trick..

Code: Select all

# How many !rules in how many seconds => stop responding.
set myrules 3:5:10

bind pub - !rules pub:rules
bind part - * rules:part

proc pub:rules {nick host hand chan text} { 
  global rules

  set called [lindex [split $::myrules ":"] 0]
  set insec [lindex [split $::myrules ":"] 1]
  set reset [lindex [split $::myrules ":"] 2]

  if {![info exists rules([strlwr $chan])]} {
    set rules([strlwr $chan]) 0
  }
  incr rules([strlwr $chan])
  utimer $reset [list rulesreset $chan]
  if {$rules([strlwr $chan]) >= $called} {
    return
  }
  putserv "Notice $nick :Rule 1.." 
  putserv "Notice $nick :Rule 2.." 
  putserv "Notice $nick :etc...." 
}

proc rulesreset {chan} {
  global rules
  incr rules([strlwr $chan]) -1
  return
}

proc rules:part {nick uhost hand chan msg} {
  global rules
  if {$nick != $::botnick} {
    return
  }
  foreach arr_part [array names rules] {
    if {[string match [strlwr $chan] $arr_part]} {
      array unset rules [strlwr $chan]
    }
  }
}
Once the game is over, the king and the pawn go back in the same box.
Locked