mIRC Home    About    Download    Register    News    Help

Print Thread
Vote with static answers #237005 10/04/12 03:00 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
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.

Re: Vote with static answers [Re: spermis] #237052 12/04/12 02:44 PM
Joined: Sep 2004
Posts: 10
M
macrobody Offline
Pikka bird
Offline
Pikka bird
M
Joined: Sep 2004
Posts: 10
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
}
}

Re: Vote with static answers [Re: spermis] #237073 13/04/12 06:04 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
You can go here and look if you find something for you.

http://www.mircscripts.org/

Search the Addon, Snippets and Tutorials section.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: Vote with static answers [Re: sparta] #237076 13/04/12 10:16 AM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
I know, I didnt find anything that suits my needs. frown

Re: Vote with static answers [Re: spermis] #237078 13/04/12 10:22 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Look at the addons you find there, you asked for a tutorial, see how they made it and try make fit ur needs..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }