Rus Ruleti Oyun TCL
Kod:
###Rus Ruleti TCL
#istek ve önerileriniz için açığım. TCL Hakkında herhangi bir fikriniz var ise benimle irtibata geçiniz. DESTEK@İRCFORUMLAR.COM
#list lucky comments
set pull {
"hizlica tetigi ceker..."
"titreyerek elini tetige goturur ve silayi yavasca sakagina dayar...."
"tetigi cekerken, yuzunde soguk ve sakin gulumseme belirir...."
"tabancayi agzina sokar...."
"tabancayi kaslarinin arasina yerlestirir ve sessizce dua eder..."
"yavasca silahi kaldirir ve cenesinin altina sabitler...."
}
set lucky_msg {
"...klik......Oops..bu silahi doldurmayi mi unuttum ?"
".....klik....Bu sansin daha fazla surmeyecek hahaha"
".klik........Gelecek sefere kursun ile bir randevun olacak hahaha"
".klik....... Seni sansli budala"
"......klik....Sanslisin o kursun calismadi...Ping silaha yeni kursun doldurur"
"....klik.....Bahse varim sen lotoda da bu kadar sansliydin"
"....klik......Cevir ya da ates et umursamiyorum, eger kazanirsan seni kendi ellerimle oldururum"
".....klik.....iyi oldugunu saniyorsun.....birdahaki sefere karsina cikmaya curet ediyorum"
"....klik......Eger senin gibi bi kafam olsaydi kaybedene kadar devam ederdim"
".....klik......Boyle cirkin biri nasil bu kadar sansli olabilir"
}
#set vars
set player1 ""
set player2 ""
set curplayer ""
set notcurplayer ""
set timeout_timer 0
set started 0
set turns 0
set bullit [rand 5]
#file you want scores to be written
set scorefile "roulette.txt"
set kill_count 0
set last_warn ""
#binds
bind pub - !cevir spin:gun
bind pub - !vur shoot:gun
bind pub - !rulet challenge:player
bind pub - !tekrar reply:player
bind pub - !kabul accept
bind pub - !tavuk chicken
bind pub - !skor show_player_score
bind pub - !skorlar showall
proc accept {nick host handle chan arg} {
global rrstarttimer
if {[utimerexists started]!=""} {killutimer $rrstarttimer}
reply:player $nick $host $handle $chan "accept"
}
proc chicken {nick host handle chan arg} {
reply:player $nick $host $handle $chan "chicken"
}
#proc to get somebody ro play with you
proc challenge:player {nick host handle chan arg} {
global botnick player1 player2 started timeout_timer kill_count last_warn notcurplayer
global rrstarttimer rrchannel
if {$player1 != ""} {
puthelp "PRIVMSG $chan :Kusura bakma $player1 zaten $player2 'a meydan okundu"
return 0
}
if {![onchan $arg $chan]} {
if {$nick == $last_warn} {
puthelp "PRIVMSG $chan :Simdi beni rahatsiz etmeye basladin, seni vurmam gerek."
kill $nick $chan
return 0
}
puthelp "PRIVMSG $chan :Kusura bakma ama bu kanalda $arg diye birini bulamiyorum. ismini dogru aldigina emin misin?"
puthelp "PRIVMSG $chan :Eger bunu tekrar yaparsan seni vururum."
set last_warn $nick
return 0
}
if {$arg == ""} {
puthelp "PRIVMSG $chan :Oyunu baslatmak icin !rulet <nick> komutunu yap"
return 0
}
if {$started == 1} {
puthelp "PRIVMSG $chan :Oyun zaten devam ediyor"
return 0
}
if {$arg == $botnick} {
puthelp "PRIVMSG $chan :Meydan okuma kabul edildi"
puthelp "PRIVMSG $chan :RRRRRRRRRrrrrrrrr....."
kill $nick $chan
return 0
}
set player1 $nick
set player2 $arg
set rrchannel $chan
set timeout_timer 1
utimer 20
[list timeout $chan ]
set rrstarttimer [utimer 50 started]
putquick "NOTICE $player2 :$nick Rus Ruleti oynamaniz icin size meydan okuyor."
putquick "NOTICE $player1 :Meydan okuma $player2 a gonderildi"
putquick "NOTICE $player2 :kabul etmek icin !kabul, korkup kacmak icin !tavuk"
return 0
}
proc reply:player {nick host handle chan arg} {
global botnick player1 player2 turns started curplayer timeout_timer notcurplayer
global rrstarttimer rrchan
if {$player1 == ""} {
puthelp "NOTICE $nick :Henuz size meydan okuyan cikmadi"
puthelp "NOTICE $nick :Birine meydan okumak icin !rulet <nick> yap"
return 0
}
if {$nick != $player2} {
puthelp "NOTICE $nick :Bu senin cagrin degil. $player1 $player2 ye meydan okudu"
return 0
}
if {$arg == ""} {
puthelp "NOTICE $nick :kabul etmek icin !kabul, redetmek icin !tavuk"
return 0
}
if {$started == 1} {
puthelp "PRIVMSG $chan :Oyun zaten devam ediyor"
return 0
}
if {$arg == "chicken"} {
puthelp "PRIVMSG $chan :$nick korktu. $player2 sen odlegin birisin."
set player1 ""
set player2 ""
return 0
}
if {$arg == "accept"} {
set curplayer $player1
set notcurplayer $player2
set rrchan $chan
putserv "notice $player1 :$nick meydan okumani kabul etti."
putserv "notice $player1 :$curplayer once basliyor. !vur tetigi ceker, !cevir tetigi cekmeden once tabancayi cevirir"
putserv "notice $player2 :$curplayer once basliyor. !vur tetigi ceker, !cevir tetigi cekmeden once tabancayi cevirir"
incr_stats $curplayer "" "" "" "" ""
incr_stats $notcurplayer "" "" "" "" ""
set started 1
set timeout_timer 0
return 0
}
}
proc spin:gun {nick host handle chan arg} {
global botnick player1 player2 turns started bullit curplayer
if {$nick != $curplayer} {
puthelp "PRIVMSG $chan :Hey sahtekarlik yok, senin siran degil."
return 0
}
if {$started == 0} {
puthelp "PRIVMSG $chan :Oyun devam etmiyor. Oynamak icin !rulet <nick>"
return 0
}
set bullit [rand 5]
puthelp "PRIVMSG $chan :$curplayer tabancayi cevirir.....RRRRRRRRRrrrrrrrrre..."
incr_stats $curplayer "" "" "" "+ 1" ""
shoot:gun $nick $host $handle $chan $started
return 0
}
proc shoot:gun {nick host handle chan arg} {
global botnick player1 player2 turns curplayer started bullit lucky_msg pull notcurplayer playerstat
if {$started == 0} {
puthelp "PRIVMSG $chan :Oyun devam etmiyor. Oynamak icin !rulet <nick>"
return 0
}
if {$nick != $curplayer} {
puthelp "PRIVMSG $chan :Hey sahtekarlik yok, senin siran degil."
return 0
}
set checknr1 [rand [llength $pull]]
set temp_pull $pull
set temp_pull [lindex $temp_pull $checknr1]
puthelp "PRIVMSG $chan :$nick $temp_pull"
incr_stats $curplayer "" "" "+ 1" "" ""
#check if bullit is on position 0 if it is then your dead
if {$bullit != 0} {
#if not then set bullit - 1 like in a real fun
set bullit [expr $bullit - 1]
#increase turns taken for stats
set turns [expr $turns + 1]
#insert random msg
set checknr [rand [llength $lucky_msg]]
set temp_lol $lucky_msg
set temp_lol [lindex $temp_lol $checknr]
puthelp "PRIVMSG $chan :$temp_lol"
#switch playsers so nobody can before there turn
if {$curplayer == $player1} {
set curplayer $player2
set notcurplayer $player1
} else {
set curplayer $player1
set notcurplayer $player2
}
puthelp "notice $curplayer :Senin siran !vur ya da !cevir"
puthelp "notice $notcurplayer :$curplayer'nin sirasi"
return 0
#if bullit was on position 0 kick loser from chan and reset all used variables
} else {
incr_stats $curplayer "" "+ 1" "" "" "+ 1"
incr_stats $notcurplayer "+ 1" "" "" "" "+ 1"
show_score $notcurplayer
putlog "$playerstat"
puthelp "KICK $chan $curplayer :\002 \00304 *BANG*!! Sen bir Olusun!! Kazanan $playerstat"
puthelp "PRIVMSG $chan :\002 \00312Oynamak icin -> !rulet <nick> , skorlar icin -> !skorlar nick , skor sorgulamak icin ->!skor <nick>"
set player1 ""
set player2 ""
set curplayer ""
set bullit [rand 5]
set started 0
return 0
}
}
proc kill {nick chan} {
global botnick
set bullit [rand 5]
for {set x 1} {$x < $bullit} {incr x} {
puthelp "PRIVMSG $chan :klik..."
}
puthelp "PRIVMSG $chan :...BANG!!! Kaybettin! "
puthelp "KICK $chan $nick : Evet kral hala benim =p"
return 0
}
proc timeout { chan } {
global botnick player1 player2 turns curplayer started bullit lucky_msg pull timeout_timer
if {$timeout_timer == 1} {
puthelp "PRIVMSG $chan : $player2 muhtemelen tavuk gibi korktu"
set player1 ""
set player2 ""
set curplayer ""
set bullit [rand 5]
set timeout_timer 0
set started 0
return 0
}
}
proc get_scores {} {
global botnick scorefile rrscoresbyname rrscorestotal rrscores rrranksbyname rrranksbynum
if {[file exists $scorefile]&&[file size $scorefile]>2} {
set _sfile [open $scorefile r]
set rrscores [lsort -dict -decreasing [split [gets $_sfile] " "]]
close $_sfile
set rrscorestotal [llength $rrscores]
} else {
set rrscores ""
set rrscorestotal 0
}
if {[info exists rrscoresbyname]} {unset rrscoresbyname}
if {[info exists rrranksbyname]} {unset rrranksbyname}
if {[info exists rrranksbynum]} {unset rrranksbynum}
set i 0
while {$i<[llength $rrscores]} {
set _item [lindex $rrscores $i]
set _nick [lindex [split $_item ,] 5]
set _win [lindex [split $_item ,] 0]
set _lost [lindex [split $_item ,] 1]
set _shots [lindex [split $_item ,] 2]
set _spins [lindex [split $_item ,] 3]
set _played [lindex [split $_item ,] 4]
set rrscoresbyname($_nick) $_win
set rrranksbyname($_nick) [expr $i+1],$_win
set rrranksbynum([expr $i+1]) $_nick,$_win
incr i
}
return
}
proc incr_stats {who win loss shots spins played} {
global botnick scorefile rrscoresbyname rrscorestotal rrscores rrranksbyname rrranksbynum
set who [lindex [split $who "|"] 0]
set who [lindex [split $who "_"] 0]
get_scores
if {$rrscorestotal>0} {
set i 0
if {[lsearch $rrscores "*,*,*,*,*,$who"]==-1} {
append _newscores "0,0,0,0,0,$who "
}
while {$i<[expr [llength $rrscores] - 1]} {
set _item [lindex $rrscores $i]
set _nick [lindex [split $_item ,] 5]
set _win [lindex [split $_item ,] 0]
set _lost [lindex [split $_item ,] 1]
set _shots [lindex [split $_item ,] 2]
set _spins [lindex [split $_item ,] 3]
set _played [lindex [split $_item ,] 4]
if {[strlwr $who]==[strlwr $_nick]} {
append _newscores "[expr $_win $win],[expr $_lost $loss],[expr $_shots $shots],[expr $_spins $spins],[expr $_played $played],$_nick "
} else {
append _newscores "$_win,$_lost,$_shots,$_spins,$_played,$_nick "
}
incr i
}
} else {
append _newscores "0,0,0,0,0,$who "
}
set _sfile [open $scorefile w]
puts $_sfile "$_newscores"
close $_sfile
return 0
}
proc show_score {text} {
global rrscoresbyname rrscores playerstat
get_scores
set idx [lsearch -glob $rrscores "*,*,*,*,*,$text"]
putlog "[lindex $rrscores $idx]"
set _item [lindex $rrscores $idx]
set _nick [lindex [split $_item ,] 5]
set _win [lindex [split $_item ,] 0]
set _lost [lindex [split $_item ,] 1]
set _shots [lindex [split $_item ,] 2]
set _played [lindex [split $_item ,] 4]
set playerstat "$_nick \00307oynanan $_played oyun, \00309kazanilan $_win, \00304kaybedilen $_lost, \00313hedefe $_shots atis"
return
}
proc showall {nick uhost handle chan arg} {
global botnick scorefile rrscoresbyname rrscorestotal rrscores rrranksbyname rrranksbynum
get_scores
set totallength 16
if {$rrscorestotal>0} {
putquick "PRIVMSG $nick :\00304*****************Rulet Skor**********************"
putquick "PRIVMSG $nick :\00304**| NickName | Toplam | Kazanılan | Kayıp | Atışlar \00304|**"
putquick "PRIVMSG $nick :\00304**|-----------------|-------|-------|------|-------|**"
set i 0
while {$i<[expr [llength $rrscores] - 1]} {
set checked 0
set _item [lindex $rrscores $i]
set _nick [lindex [split $_item ,] 5]
set _win [lindex [split $_item ,] 0]
if {$_win < 10} {
set _win " $_win "
} elseif {$_win < 100} {
set _win " $_win "
}
set _lost [lindex [split $_item ,] 1]
if {$_lost < 10} {
set _lost " $_lost "
} elseif {$_lost < 100} {
set _lost " $_lost "
}
set _shots [lindex [split $_item ,] 2]
if {$_shots < 10} {
set _shots " $_shots "
} elseif {$_shots < 100} {
set _shots " $_shots "
}
set _played [lindex [split $_item ,] 4]
if {$_played < 10} {
set _played " $_played "
} elseif {$_played < 100} {
set _played " $_played "
}
set checknick [split $_nick ""]
set who [lindex [split $nick "|"] 0]
set who [lindex [split $who "_"] 0]
if {[string tolower $who] == [string tolower $_nick]} {set checked 1}
set long [llength $checknick]
set spaces ""
for {set i2 $long} {$i2 < $totallength} {incr i2} {
append spaces " "
}
if {$checked == 1} {
putquick "PRIVMSG $nick :\00304**| \00312$_nick$spaces\00304|\00312$_played\00304|\00312$_win\00304|\00312$_lost\00304|\00312$_shots\00304|**"
} else {
putquick "PRIVMSG $nick :\00304**| \00310$_nick$spaces\00304|\00310$_played\00304|\00310$_win\00304|\00310$_lost\00304|\00310$_shots\00304|**"
}
incr i
}
putquick "PRIVMSG $nick :\00304********************Liste Sonu**********************"
}
return 0
}
proc show_player_score {nick host handle chan arg} {
global rrscoresbyname rrscores playerstat
if {$arg == ""} { set arg $nick } else { set arg [lindex [split $arg " "] 0] }
show_score $arg
puthelp "PRIVMSG $chan : $playerstat"
return 1
}
proc started {} {
putlog "starttimer ended"
}
proc tggamemsg {what} {global rrchannel;putquick "PRIVMSG $rrchannel :[tgbold]$what"}
putlog "\Rus Ruleti Yuklendi.By yok"