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 on a script

Old posts that have not been replied to for several years.
Locked
K
Kimmi
Halfop
Posts: 58
Joined: Thu Jul 24, 2003 4:17 pm
Location: Norway
Contact:

Need help on a script

Post by Kimmi »

Hello
Im running a quiz channel. But user sometime give me a hard time.
When some users dont know what the answer is, they can type "!hint" and bot gives them a hint. But to often user dont know when to stop, and channel looks like this:
!hint
!hint
!hint
!hint
!hint

So Im looking for a script that tempbans users with a message that they type to many "!hint" and get banned for like 3min.
This script would allow like, 3 * !hint every minut or so, from each user.

Is there any scripts like this, or anyone have the knowlegde to make sutch?

Thanx
Kimmi
Kimmi@EFnet
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

I think it would be best to incorporate this "flood protection" in the actual proc giving the hints... Try this (not tested, of course :P)

Code: Select all

# add this at the top of the hint proc:
global hintFlood
scan $hintFlood(ratio) %i:%i times time
set now [clock sec]
if {[info exists hintFlood($uhost)]} {
	set i 0
	foreach ts $hintFlood($uhost) {if {$ts>$now} break; incr i}
	if {$i} {
		set hintFlood($uhost) [lrange $hintFlood($uhost) $i end]
	} elseif {[llength $hintFlood($uhost)]==$times} {
		puthelp "NOTICE $nick :Calm down.";# or ban or whatever...
		return 1
	}
}
lappend hintFlood($uhost) [incr now $time]

# outside the proc: (times:seconds)
set hintFlood(ratio) 3:60
Have you ever read "The Manual"?
Locked