alias poll {
dialog -m poll poll
}
menu channel {
poll:/dialog -m poll poll
}
dialog poll {
title "poll script by kumano33"
size -1 -1 150 90
option dbu
button "ok", 2, 40 70 22 17
button "cancel", 3, 65 70 22 17, cancel
box "poll settings", 4, 1 1 150 65
edit "insert poll question here", 5, 5 20 120 10
button "show current results", 6, 5 50 60 10
button "end vote", 7, 5 40 60 10
}
on *:dialog:poll:sclick:2: {
if ($did(5) == $null || $did(5) == insert poll question here) { HALT }
elseif (%poll != on) {
set %voteyes 0
set %voteno 0
/set %poll on
/msg #cw0wnz $me started a poll:4 $did(5) $+ ,1 the poll will last 2 minutes, you can vote with !yes or !no
timer 1 120 set %poll off
timer 1 125 unset %vote*
}
else echo there is already a poll running/the question is invalid
}
on *:dialog:poll:sclick:7: {
if (%poll == off) { HALT }
else if (%poll == on) {
set %poll off
msg #cw0wnz $me ended the poll, the results were:12 %voteyes yes and %voteno no
unset %vote*
timer* off
}
}
on *:dialog:poll:sclick:6: {
if (%poll == on) {
msg #cw0wnz 12 %votequestion $+ , 1so far there has been voted:12 %voteyes yes and %voteno no
}