 |
|
 |
|
Suparatu Administrator


Data inscrierii: 12/Mai/2008 Mesaje: 24
|
|
 |
|
 |
|
Trimis: 17/05/2008 07:02 Titlul subiectului: boom.tcl (bomba) |
|
|
set vers "1.0"
setudef flag nopubboom
bind pub - !bomba pub:boom
proc pub:boom { nick uhost hand chan text } {
global array_variety isstart sec nik bombtimer user_color inhand key_wire botnick
set user_color "[lindex $text 1]"
set nik "[lindex $text 0]"
set mylist "[chanlist $chan]"
set chec "[lsearch $mylist $nik]"
#Checking up channel flag
if {[channel get $chan nopubboom]} {
puthelp "notice $nick :\003Pe canalul\0034 $chan \003este interzis aceasta joaca!"
return
}
if { $nik == $botnick } {
return
}
if { ![isop $botnick $chan] } {
puthelp "notice $nick :\0036Botul nu are op pe\0034 $chan \0036, joaca este oprita!"
return
}
#Checking nick's presents
if { $nik == "" } {
puthelp "notice $nick :\0036Nu ati ales cui ii da`ti bomba"
return
}
#Checking presents nick on chan
if { $chec == -1 } {
puthelp "notice $nick :\003Nick-ul\0034 $nik \003nu este pe canalul\0034 $chan !"
return
}
if { [info exists isstart(host,$uhost)] } {
puthelp "notice $nick :\0036Puteti folosi odata in\0034 5 \0036minute"
return
}
#Placing main variables
set array_timer { 25 15 18 19 20 28 23 30 }
set sec [lindex $array_timer [rand [llength $array_timer]]]
set array_wire { 2 3 4 5 }
set num [lindex $array_wire [rand [llength $array_wire]]]
set array_variety { "\0034rosu\003" "\00312albastru\003" "\0033verde\003" "\0038galben\003" "\00313roz\003" "\0036violet\0036" "\0037portocaliu\003" }
#Checking number of wires
if { $num == 2 } {
set col1 [rand [llength $array_variety]]
set color1 [lindex $array_variety $col1]
set array_variety [lreplace $array_variety $col1 $col1]
set col2 [rand [llength $array_variety]]
set color2 [lindex $array_variety $col2]
set use_colors [list $color1 $color2]
set key_wire [lindex $use_colors [rand [llength $use_colors]]]
putserv "privmsg $chan :\0034 \002$nick\002 \0032ii da\0034\002 $nik \002\0032in mina bomba!!! Pe timer sunt\0034\037 $sec \037\0032secunde... Pe bomba sunt\0034\037 $num \037\0032fire:\[ $use_colors \].\002\0034 $nik \002\0032, Tasteaza\0034 !taie \0032si culoarea firului pentru a dezactiva bomba"
set bombtimer(timer,$nik) [utimer $sec [list nicktimer:die $nik $chan ]]
set inhand(nick,$nik) 1
}
if { $num == 3 } {
set col1 [rand [llength $array_variety]]
set color1 [lindex $array_variety $col1]
set array_variety [lreplace $array_variety $col1 $col1]
set col2 [rand [llength $array_variety]]
set color2 [lindex $array_variety $col2]
set array_variety [lreplace $array_variety $col2 $col2]
set col3 [rand [llength $array_variety]]
set color3 [lindex $array_variety $col3]
set use_colors [list $color1 $color2 $color3]
set key_wire [lindex $use_colors [rand [llength $use_colors]]]
putserv "privmsg $chan :\0034 \002$nick\002 \0032ii da lu\0034\002 $nik \002\0032in mina bomba!!! Pe timer sunt\0034\037 $sec \037\0032secunde... Pe bomba sunt\0034\037 $num \037\0032fire:\[ $use_colors \].\002\0034 $nik \002\0032, Tasteaza\0034 !taie \0032si colorație firului pentru a dezactiva bomba"
set bombtimer(timer,$nik) [utimer $sec [list nicktimer:die $nik $chan ]]
set inhand(nick,$nik) 1
}
if { $num == 4 } {
set col1 [rand [llength $array_variety]]
set color1 [lindex $array_variety $col1]
set array_variety [lreplace $array_variety $col1 $col1]
set col2 [rand [llength $array_variety]]
set color2 [lindex $array_variety $col2]
set array_variety [lreplace $array_variety $col2 $col2]
set col3 [rand [llength $array_variety]]
set color3 [lindex $array_variety $col3]
set array_variety [lreplace $array_variety $col3 $col3]
set col4 [rand [llength $array_variety]]
set color4 [lindex $array_variety $col4]
set use_colors [list $color1 $color2 $color3 $color4]
set key_wire [lindex $use_colors [rand [llength $use_colors]]]
putserv "privmsg $chan :\0034 \002$nick\002 \0032ii da\0034\002 $nik \002\0032in mina bomba!!! Pe timer sunt\0034\037 $sec \037\0032secunde... Pe bomba sunt\0034\037 $num \037\0032fire:\[ $use_colors \].\002\0034 $nik \002\0032, Tasteaza\0034 !taie \0032si colorit firului pentru a dezactiva bomba"
set bombtimer(timer,$nik) [utimer $sec [list nicktimer:die $nik $chan]]
set inhand(nick,$nik) 1
}
if { $num == 5 } {
set col1 [rand [llength $array_variety]]
set color1 [lindex $array_variety $col1]
set array_variety [lreplace $array_variety $col1 $col1]
set col2 [rand [llength $array_variety]]
set color2 [lindex $array_variety $col2]
set array_variety [lreplace $array_variety $col2 $col2]
set col3 [rand [llength $array_variety]]
set color3 [lindex $array_variety $col3]
set array_variety [lreplace $array_variety $col3 $col3]
set col4 [rand [llength $array_variety]]
set color4 [lindex $array_variety $col4]
set array_variety [lreplace $array_variety $col4 $col4]
set col5 [rand [llength $array_variety]]
set color5 [lindex $array_variety $col5]
set use_colors [list $color1 $color2 $color3 $color4 $color5]
set key_wire [lindex $use_colors [rand [llength $use_colors]]]
putserv "privmsg $chan :\0034 \002$nick\002 \0032ii da\0034\002 $nik \002\0032in mina bomba!!! Pe timer sunt\0034\037 $sec \037\0032secunde... Pe bomba sunt\0034\037 $num \037\0032fire:\[ $use_colors \].\002\0034 $nik \002\0032, Tasteaza\0034 !taie \0032si nuanță firului pentru a dezactiva bomba"
set bombtimer(timer,$nik) [utimer $sec [list nicktimer:die $nik $chan ]]
set inhand(nick,$nik) 1
}
#Establising delay between bomb using
set isstart(host,$uhost) 1
set isstart(timer,$uhost) [ utimer 300 [list start:reset $uhost ] ]
}
#Kick user if bomb timeout
proc nicktimer:die { nik chan } {
putkick $chan $nik "\0034\002BOOM!\002\0035 Timpul a trecut!!!\003"
catch {killutimer $bombtimer(timer,$nik)}
catch {unset bombtimer(timer,$nik)}
catch {unset inhand(nick,$nik)}
}
#Kill delay timer between bomb using
proc start:reset { uhost } {
global isstart
catch {killutimer $isstart(timer,$uhost)}
catch {unset isstart(timer,$uhost)}
catch {unset isstart(host,$uhost)}
}
#Procedure to neutralize the bomb
bind pub - !taie bomb:neut
proc bomb:neut { nick uhost hand chan text } {
global bombtimer key_wire inhand nik use_colors
set key_wire_mod "[ string trim $key_wire \003,\00312,\0033,\0036,\0037,\0038,\00313,\0034 ]"
set user_color "[lindex $text 0]"
#Checking bomb running
if { ![info exists inhand(nick,$nik)] } {
puthelp "notice $nick :\0036Bomba nu este pornita!!"
return
}
#Checking nick conformity
if { $nick != $nik } {
puthelp "notice $nick :\0036Bomba nu e la tine! Poate taia numa acel la care este bomba!"
return
}
if { $user_color == "" } {
puthelp "notice $nick :\0036Nu ati indicat culoarea firului"
return
}
if { [string match $key_wire_mod $user_color] } {
putserv "privmsg $chan :\002\0034 $nick \002\0032Ai dezactivat cu succes,\002\0034 FELICITARI!!!"
catch {killutimer $bombtimer(timer,$nik)}
catch {unset bombtimer(timer,$nik)}
catch {unset inhand(nick,$nik)}
return
}
putkick $chan $nick "\0034\002BOOM!\002\0035 Nu acest fir!!!\003"
catch {killutimer $bombtimer(timer,$nik)}
catch {unset bombtimer(timer,$nik)}
catch {unset inhand(nick,$nik)}
}
putlog "Loaded BOMB version $vers" |
|