rendered paste bodyon *:TEXT:!vote*:#:{
if ($nick isop $chan) || ($nick ishop $chan) || ($address($nick,2) == *!*@Owns.You.For.Real) && $2 isnum {
set %thevote [ $+ [ $chan ] ] $($+(4,$3-))
set %votetime [ $+ [ $chan ] ] $2
msg $chan Please vote !yes or !no to the set vote: $3- ~ this will last for $2 mins.
timervote [ $+ [ $chan ] ] 1 $calc( %votetime [ $+ [ $chan ] ] * 60 ) /voting.end $chan
}
}
on *:TEXT:!yes*:#:{
if (%thevote [ $+ [ $chan ] ] == $null) { HALT }
if (%thevote [ $+ [ $chan ] ] != $null) && ($readini(vote.ini,vote,$nick) == $chan) { notice $nick You already voted -.- | halt }
else {
inc %yescount [ $+ [ $chan ] ]
writeini vote.ini vote $chan $nick
notice $nick Your vote has been added
msg $chan %thevote [ $+ [ $chan ] ] ~ yes: %yescount [ $+ [ $chan ] ] ~ no: %nocount [ $+ [ $chan ] ]
}
}
on *:TEXT:!no*:#:{
if (!%thevote [ $+ [ $chan ] ]) { HALT }
if (%thevote [ $+ [ $chan ] ]) && ($readini(vote.ini,vote,$nick) == $chan) { notice $nick You already voted -.- | halt }
else {
inc %nocount [ $+ [ $chan ] ]
writeini vote.ini vote $chan $nick
notice $nick Your vote has been added
msg $chan %thevote [ $+ [ $chan ] ] ~ yes: %yescount [ $+ [ $chan ] ] ~ no: %nocount [ $+ [ $chan ] ]
}
}
on *:TEXT:!endvote*:#:{
if ($nick isop $chan) || ($nick ishop $chan) || ($address($nick,2) == *!*@Owns.You.For.Real) {
/voting.end $chan
/timervote [ $+ [ $chan ] ] off
unset %thevote [ $+ [ $1 ] ]
unset %votetime [ $+ [ $1 ] ]
unset %yescount [ $+ [ $1 ] ]
unset %nocount [ $+ [ $1 ] ]
remini vote.ini vote $chan
}
}
alias /voting.end {
if (!%nocount [ $+ [ $1 ] ]) && (%yescount [ $+ [ $1 ] ]) {
msg $1 The vote has ended ~ %thevote [ $+ [ $1 ] ]
msg $1 The results ~ Yes: %yescount [ $+ [ $1 ] ] ~ No: %nocount [ $+ [ $1 ] ]
msg $1 in percent: Yes: 100% No: 0%
unset %thevote [ $+ [ $1 ] ]
unset %votetime [ $+ [ $1 ] ]
unset %yescount [ $+ [ $1 ] ]
unset %nocount [ $+ [ $1 ] ]
remini vote.ini vote $chan
halt
}
if (!%yescount [ $+ [ $1 ] ]) && (%nocount [ $+ [ $1 ] ]) {
msg $1 The vote has ended ~ %thevote [ $+ [ $1 ] ]
msg $1 The results ~ Yes: %yescount [ $+ [ $1 ] ] ~ No: %nocount [ $+ [ $1 ] ]
msg $1 in percent: Yes: 0% No: 100%
unset %thevote [ $+ [ $1 ] ]
unset %votetime [ $+ [ $1 ] ]
unset %yescount [ $+ [ $1 ] ]
unset %nocount [ $+ [ $1 ] ]
remini vote.ini vote $chan
halt
}
if (%nocount [ $+ [ $1 ] ]) && (%yescount [ $+ [ $1 ] ]) {
msg $1 The vote has ended ~ %thevote [ $+ [ $1 ] ]
msg $1 The results ~ Yes: %yescount [ $+ [ $1 ] ] ~ No: %nocount [ $+ [ $1 ] ]
msg $1 In percent: Yes: $calc((%yescount [ $+ [ $1 ] ]) + (%yescount [ $+ [ $1 ] ])))
unset %thevote [ $+ [ $1 ] ]
unset %votetime [ $+ [ $1 ] ]
unset %yescount [ $+ [ $1 ] ]
unset %nocount [ $+ [ $1 ] ]
remini vote.ini vote $chan
halt }
elseif (!%nocount [ $+ [ $1 ] ]) && (!%yescount [ $+ [ $1 ] ]) {
HALT }
}