mIRC Homepage

Vote with static answers

Posted By: spermis

Vote with static answers - 10/04/12 03:00 PM

Hello.
Could someone make a snippet for me, that allows users to vote, but vote for choices that are permament and saved in a text file.

Example would be - if admin writes !presidentvote , the bot says:

Vote has started: choose to vote for Obama, Bush, Craig, George.

Then users vote with command - !vote Obama etc.
For example four people type !vote Obama , and three people !vote Craig .
The bot should automatically stop the vote after 1 minute, and then show the results like this:

Vote results: Obama - 4 , Craig - 3 .

It should show them without showing the ones which did not get any votes.
Posted By: macrobody

Re: Vote with static answers - 12/04/12 02:44 PM

I found something old but maybe you can use it:


Polling options
.Conduct a poll in $chan:{
if (%pollchan != $null) {
/set %uatext Sorry, there is allready a poll in progress on %pollchan $+ !
/set %uaatext It expires in $timer(endpoll).secs seconds - please try again then.
/useralert
/halt
}
/write votecheck.txt Checker file
/set %pollchan $chan
/set %polltitle $?="Enter poll title"
if (%polltitle == $null) { /unset %pollchan | /halt }
:getnumoptions
/set %numoptions $?="Enter number of options"
if (%numoptions == $null) { /unset %pollchan | /halt }
if ((%numoptions < 1) || (%numoptions !isnum)) goto getnumoptions
/var %counter 1
:getoptions
if (%counter < %numoptions + 1) {
/var %option $?="Enter option %counter $+ "
if (%option == $null) { /unset %pollchan | /halt }
/write voteoptions.txt 0 %option
/inc %counter
goto getoptions
}
:getlimit
/set %timelimit $?="Enter voting time limit in seconds"
if (%timelimit == $null) { /unset %pollchan | /halt }
if ((%timelimit < 1) || (%timelimit !isnum)) goto getlimit
/poll
}
.Abort current poll:{
if (%pollchan == $null) {
/set %uatext There is no poll in progress at the moment.
/useralert
/halt
}
else {
/set %timeleft $timer(endpoll).secs
/set %aborted 1
.timerendpoll off
/endpoll
}
}
Posted By: sparta

Re: Vote with static answers - 13/04/12 06:04 AM

You can go here and look if you find something for you.

http://www.mircscripts.org/

Search the Addon, Snippets and Tutorials section.
Posted By: spermis

Re: Vote with static answers - 13/04/12 10:16 AM

I know, I didnt find anything that suits my needs. frown
Posted By: sparta

Re: Vote with static answers - 13/04/12 10:22 AM

Look at the addons you find there, you asked for a tutorial, see how they made it and try make fit ur needs..
© 2021 mIRC Discussion Forums