Change:
%bet_ [ $+ [ $nick ] $+ ] _total
To:
$($+(%,bet_,$nick,_total),2)
If you really want to mess around with []'s, you can change it to:
%bet_ [ $+ [ $nick ] $+ [ _total ] ]
I didn't look closely, so there may be other issues, but there's the first problem I noticed.