[/code]
on *:TEXT:!roll*:#: {
if ($hget(MasterList,$nick) == Master) {
set %tempWinnerAmount $2
msg %giveawayautotokenschannel Rolling
var %i = 1, %a
:next
while ($hget(TwitchChannelUsers,%i).data) {
if ($v1 >= %tempWinnerAmount) { %a = %a $hget(TwitchChannelUsers,%i).item }
inc %i
}
if ($numtok(%a,32)) {
set %currentgiveawaywinneris $gettok(%a,$rand(1,$v1),32)
if (%currentgiveawaywinneris ison %giveawayautotokenschannel) {
if ($hget(KeywordList,%currentgiveawaywinneris) == %CurrentKeywordIS) {
.timerWinner 1 5 msg %giveawayautotokenschannel Winner!!!! = %currentgiveawaywinneris
.hdec TwitchChannelUsers %currentgiveawaywinneris %tempWinnerAmount
.timer 1 5 msg %giveawayautotokenschannel Deleted %tempWinnerAmount Tokens from %currentgiveawaywinneris
.halt
}
else { goto next }
}
else { goto next }
}
}
else { halt }
}
[code]