on *:TEXT:*:#Alessandra:{
if ($1 == !game && $nick($chan,$nick,~@)) {
set %topnum $iif($2,$2,100) | set %number $rand(1,%topnum)
msg $chan Guess the number 1 to %topnum | hfree -w number *
}
if ($1 == !number) {
if (!%number) { msg $chan Come up with a new number: !game [number] | return }
if (!$2) { notice $nick Correct syntax: !number <number> | return }
if ($2 !isnum $+(1-,%topnum)) { notice $nick Possible range: !number $v2 | return }
if ($hget(number,$nick)) { notice $nick The next attempt is possible in $v1 secs. | return }
if ($2 > %number) { msg $chan The number $2 is greater than the hidden number. }
if ($2 < %number) { msg $chan The number $2 is less than the hidden number. }
if ($2 == %number) {
msg $chan $nick $read(you.txt,nt) you win! The number was %number
if ($read(win.txt,ntw,$nick *)) {
var %rn $readn, %score $gettok($read(win.txt,nt,%rn),2,32)
write $+(-l,%rn) win.txt $nick $calc(%score + 1)
}
else { write -i win.txt $nick 1 } | unset %number | hfree -w number * | return
}
hadd -mz number $nick 300
}
if ($1 == !score) {
if ($2) {
if ($read(win.txt,ntw,$2 *)) { msg $chan Score for $+(,$2,:) $read(win.txt,nts,$2) points }
else msg $chan There is no record in the database for a player with the nickname: $2
}
else { notice $nick Nick: --- Score: | play -nx $nick win.txt 1000 }
}
}