I am not sure who made the original votekick coding but I modified it into a votetrivia code. If anyone knows who wrote original code please let me know and I will edit it into this post.
This code allows roomies to vote whether or not they want trivia to begin. Trivia needs to be enabled in the script menu and this "#trivia on" placed at beginning of trivia script. This needs to be placed at end of trivia script "#trivia end". If the vote is No trivia is disabled. If the vote is Yes trivia is enabled. I also included a couple of timers to unset the variables.
Edited to include only one vote per nick.
on *:text:*:*: {
if ($1 == !votetrivia) {
if ($hget(votetrivia,voting)) { msg $chan Voting Already Started }
if (!$hget(votetrivia)) { hmake votetrivia 100 }
if (!$hget(votenick)) { hmake votenick 100 }
hadd votetrivia chan $chan
hadd votetrivia voting $true
msg $chan Vote Trivia Enabled - !vote yes/no - To Start Trivia ( $iif($3 > 30,$3,30) Seconds )
timervote 1 $iif($3 > 30,$3,30) voteend
}
if ($1 == !vote) {
if (!$hget(votetrivia,voting)) { halt }
if (yes == $2) {
if ($nick isin $hget(votenick,nick)) $votemsg { halt }
hadd votetrivia voted $hget(votetrivia,voted) $+ , $+ $nick
%yes = $calc($hget(votetrivia,yes) + 1)
hadd votetrivia yes %yes
hadd votenick nick $nick
msg $chan $nick $+ 's Vote Registered - Yes
}
if (no == $2) {
hadd votetrivia voted $hget(votetrivia,voted) $+ , $+ $nick
%no = $calc($hget(votetrivia,no) + 1)
hadd votetrivia no %no
hadd votenick nick $nick
msg $chan $nick $+ 's Vote Registered - No
}
}
.timer.undo3 1 41 /unset %yes
.timer.undo4 1 42 /unset %no
.timer.dela 1 50 hfree -sw votetrivia
.timer.delb 1 50 hfree -sw votenick
}
alias votemsg {
msg $hget(votetrivia,chan) Only One Vote Per Person $nick
}
alias voteend {
msg $hget(votetrivia,chan) Voting Ended - Results (Yes: $+ $iif(!$hget(votetrivia,yes),0,$hget(votetrivia,yes)) $+ ) (No: $+ $iif(!$hget(votetrivia,no),0,$hget(votetrivia,no)) $+ )
if ($hget(votetrivia,yes) == 1) { halt }
if ($iif(!$hget(votetrivia,no),0,$hget(votetrivia,no)) >= $iif(!$hget(votetrivia,yes),0,$hget(votetrivia,yes))) { msg $hget(votetrivia,chan) Trivia will not be started! } { disable #trivia }
if ($iif(!$hget(votetrivia,yes),0,$hget(votetrivia,yes)) > $iif(!$hget(votetrivia,no),0,$hget(votetrivia,no))) { msg $hget(votetrivia,chan) Type !trivia to start Type !strivia to end. } { enable #trivia }
}
Edited Feb 26, 2005 9:20 PM by Mail