| View previous topic :: View next topic |
| Author |
Message |
dohko2006 Voice
Joined: 19 Mar 2006 Posts: 8
|
Posted: Sun Mar 19, 2006 2:59 pm Post subject: Fun Script |
|
|
small request (i thing), im looking for after a forum search (maybe im not good searching, sorry)
when ops (+o) or voices (+v) (only this two) type: !rock nick ... the bot respond
* Bot throws a rock in the head of Nick
a tiny example (nicks: Bot, +Nick, AnotherNick)
<+Nick>!rock AnotherNick
* Bot throws a rock in the head of AnotherNick
<AnotherNick> lol
<AnotherNick> !rock Nick
<AnotherNick> wtf... not work!
<+Nick> lol...only voices and ops
and antiflood ... 4 or 5 respond total in 90-120 sec ... thx a lot.
Regards. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Mar 19, 2006 4:12 pm Post subject: |
|
|
| Code: | bind pub - !rock rock
proc rock {nick uhost hand chan arg} {
global afrock
if {![isvoice $nick $chan] && ![isop $nick $chan]} {return 0}
if {![info exists afrock([set nickchan [string tolower $nick:$chan]])]} {
set afrock($nickchan) [list [unixtime] 0]
}
foreach {t o} $afrock($nickchan) {break}
if {[unixtime]-$t > 120} { set t [unixtime]; set o 0 }
if {[incr o] > 5} { return 0 }
set afrock($nickchan) [list $t $o]
putserv "privmsg $chan :\001ACTION throws a rock in the head of [lindex [split $arg] 0]\001"
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
dohko2006 Voice
Joined: 19 Mar 2006 Posts: 8
|
Posted: Fri Mar 24, 2006 10:56 am Post subject: |
|
|
Great work Sir_Dz Working Ok... but...
If AnotherNick dont exists ... the command
!rock AnotherNick it would not have to work; and if type only "!rock" the bot say "* Bot throws a rock in the head of"
Example (Only 3 Users in the channel: Bot, +Nick, Nick2)
<+Nick>!rock Nick2
* Bot throws a rock in the head of Nick2
<Nick2>lol
<+Nick>!rock Nick3
<Nick2> Nick3? who is?
<+Nick> lol, the user Nick3 dont exist in the channel, good bot :p
<+Nick>!rock
<Nick2> nothing happen
<+Nick> of course, not type nick :p
My bot only have one channel, but have 100 -300 users daily in the channel.
Regards  |
|
| Back to top |
|
 |
astriK Voice
Joined: 23 Mar 2006 Posts: 5
|
Posted: Fri Mar 24, 2006 11:14 am Post subject: |
|
|
| dohko2006 wrote: | Great work Sir_Dz Working Ok... but...
If AnotherNick dont exists ... the command
!rock AnotherNick it would not have to work; and if type only "!rock" the bot say "* Bot throws a rock in the head of"
Example (Only 3 Users in the channel: Bot, +Nick, Nick2)
<+Nick>!rock
<Nick2> nothing happen
<+Nick> of course, not type nick :p
Regards  |
that example is meaning the Bot fine.
maybe u wana say it
<+Nick>!rock
<BoT> Bot throws a rock in the head of"
isn't? _________________ DomDom DomDom |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Mar 24, 2006 3:14 pm Post subject: |
|
|
| Code: |
bind pub - !rock random:rock
proc random:rock {nick uhost hand chan arg} {
if {![isop $nick $chan] || ![isvoice $nick $chan]} return
foreach user [chanlist $chan] {
if {[isbotnick $user] || [isvoice $user $chan] || [isop $user $chan]} continue
lappend list $user
}
if {[set len [llength $list]] < 2} {
putserv "PRIVMSG $chan :This game needs more than two users on the channel, currently I see only [expr {$len==1?"1 player":"$len players"}]."
return
}
putserv "PRIVMSG $chan :\001ACTION throws a rock in the head of [lindex $list [rand $len]]\001"
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Mar 24, 2006 7:55 pm Post subject: |
|
|
This should fix it
| Code: | bind pub - !rock rock
proc rock {nick uhost hand chan arg} {
global afrock
if {![isvoice $nick $chan] && ![isop $nick $chan]} {return 0}
if {![info exists afrock([set nickchan [string tolower $nick:$chan]])]} {
set afrock($nickchan) [list [unixtime] 0]
}
foreach {t o} $afrock($nickchan) {break}
if {[unixtime]-$t > 120} { set t [unixtime]; set o 0 }
if {[incr o] > 5} { return 0 }
set afrock($nickchan) [list $t $o]
if {[onchan [set rocked [lindex [split $arg] 0]] $chan]} {
putserv "privmsg $chan :\001ACTION throws a rock in the head of $rocked\001"
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
dohko2006 Voice
Joined: 19 Mar 2006 Posts: 8
|
Posted: Sun Mar 26, 2006 11:54 am Post subject: |
|
|
Works OK Now ... thx a lot Sir ^^ |
|
| Back to top |
|
 |
|