on *:text:$*:#yourchan: {
if (!$hget(GameStats)) {
hmake GameStats 100
if ($isfile($scriptdir\GameStats.hsh)) { hload GameStats $scriptdir\GameStats.hsh }
}
if ($1- == $won || $1- == $draw) {
msg $chan Please provide proof of your win, then type $proof followed by a link to your proof. Eg. $proof http://www.proof.com/
if ($hget(Won. $+ $nick)) { hfree Won. $+ $nick }
hmake Won. $+ $nick 5
hadd Won. $+ $nick Type $right($1,-1)
}
elseif ($1 == $proof) {
if (!$hget(Won. $+ $nick)) { msg $chan Please type $won before using $proof. | return }
if (!$2) { msg $chan Please include a link to your proof. Eg. $proof http://www.proof.com/ | return }
msg $chan Please wait for confirmation.
hadd Won. $+ $nick Proof $2-
}
elseif ($1 == $yes || $1 == $no) {
if (!$2) { msg $chan Please include the nick who you are confirming. Eg. $yes Nick | return }
if (!$hget(Won. $+ $2)) { msg $chan $2 hasn't used $won yet. | return }
if (!$hget(Won. $+ $2,Proof)) { msg $chan $2 hasn't used $proof yet. | return }
if ($istok($hget(Won. $+ $2,Yes)),$nick,32) || $istok($hget(Won. $+ $2,No)),$nick,32)) { msg $chan You have already voted on the proof. | return }
if ($1 == $yes) { hadd Won. $+ $2 Yes $hget(Won. $+ $2,Yes) $nick }
elseif ($1 == $no) { hadd Won. $+ $2 No $hget(Won. $+ $2,No) $nick }
if ($numtok($hget(Won. $+ $2,Yes),32) >= 3) {
if ($hget(Won. $+ $2,Type) == Won) {
msg $chan $2 gets 10 points for the win.
hinc GameStats $nick $+ .Points 10
hinc GameStats $nick $+ .Wins
}
elseif ($hget(Won. $+ $2,Type) == Draw) {
msg $chan $2 gets 5 points for the draw.
hinc GameStats $nick $+ .Points 5
hinc GameStats $nick $+ .Draws
}
hsave GameStats $scriptdir GameStats.hsh
}
elseif ($numtok($hget(Won. $+ $2,No),32) >= 3) {
msg $chan $2 gets 0 points because of a lack of good proof.
hfree Won. $+ $2
}
}
elseif ($1 == $lost) {
hinc GameStats $nick $+ .Loses
hsave GameStats $scriptdir\GameStats.hsh
}
elseif ($1 == $stats) {
if (!$2) {
var %Nick = $nick
}
else {
var %Nick = $2
}
if ($hget(GameStats,%Nick $+ .Points)) {
hsave -n GameStats $scriptdir\GameStats.tmp
filter -ffcuten 1 32 $scriptdir\GameStats.tmp
hsave -i GameStats $scriptdir\GameStats2.tmp
var %line = $read($scriptdir\GameStats2.tmp,s,%Nick $+ =)
var %line = $calc($readn - 1)
var %rank = $read($scriptdir\GameStats.tmp,s,%line $+ $chr(32))
var %rank = $readn
msg $chan Rank: %rank - $iif(%Nick == $nick,You have,%Nick has) $hget(GameStats,%Nick $+ .Points) with: $hget(GameStats,%Nick $+ .Wins) Wins - $hget(GameStats,%Nick $+ .Draws) Draws - $hget(GameStats,%Nick $+ .Loses) Loses.
.remove $scriptdir\GameStats.tmp
.remove $scriptdir\GameStats2.tmp
}
else msg $chan $iif(%Nick == $nick,You have,%Nick has) no points.
}
elseif ($1 == $scores) {
hsave -n GameStats $scriptdir\GameStats.tmp
filter -ffcuten 1 32 $scriptdir\GameStats.tmp
var %cnt = 1
var %lines = $iif($lines($scriptdir\GameStats.tmp) < 10,$v1,10)
while (%cnt <= %lines) {
var %data = $read($scriptdir\GameStats.tmp,%cnt)
var %Top10 = $iif(%Top10,$chr(32) $+ -) %cnt $+ $chr(41) $hget(GameStats,$gettok(%data,1,32)).item $+ : $gettok(%data,2,32)
inc %cnt
}
msg $chan Top Players: %Top10
.remove $scriptdir\GameStats.tmp
}
}
on *:input:*: {
if ($* iswm $1) {
if (!$hget(GameStats)) {
hmake GameStats 100
if ($isfile($scriptdir\GameStats.hsh)) { hload GameStats $scriptdir\GameStats.hsh }
}
}
if ($1 == $deduct) {
if ($3 !isnum) { echo -a Please include a nick and points to deduct. Eg. $deduct $me 5 | return }
echo -a Points deducted from $2 -- $hget(GameStats,$2 $+ .Points) - $3 = $calc($hget(GameStats,$2 $+ .Points) - $3)
hdec GameStats $2 $+ .Points $3
hsave GameStats $scriptdir\GameStats.hsh
}
elseif ($1 == $clear) {
if (!$2) { echo -a Please include a nick to clears stats for. | return }
hdel GameStats $2 $+ .Points
hdel GameStats $2 $+ .Wins
hdel GameStats $2 $+ .Draws
hdel GameStats $2 $+ .Loses
hsave GameStats $scriptdir\GameStats.hsh
}
elseif ($1 == $clearall) {
hfree GameStats
.remove $scriptdir\GameStats.hsh
}
}