AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   tally votes for 9 different options (https://forums.alliedmods.net/showthread.php?t=45592)

stupok 10-06-2006 14:53

tally votes for 9 different options
 
I've been looking around at other vote plugins for a way to tally votes for 9 items, and Xanimos' master_vote.amxx plugin is the only one I found that lets users vote for 9 items.

But, when looking at his code, it is beyond me how he calculates which item wins the vote. I'd appreciate a quick guide on doing that.

XxAvalanchexX 10-06-2006 23:46

Re: tally votes for 9 different options
 
Less detailed: http://forums.alliedmods.net/showpos...34&postcount=2

More detailed: http://forums.alliedmods.net/showpos...68&postcount=5

stupok 10-06-2006 23:58

Re: tally votes for 9 different options
 
Did I not make clear what I was looking for? Sorry if I did not:cry: .

I'll try again. There are 9 options for a vote.
1. something
2. something else
3. something else else
4. something else else else
5. something still different
6. something yet more different
7. something again different
8. something slightly different
9. something not so different

Now, one client voted for #1, another voted for #5, another voted for #7, etc. until all of the clients have voted!
How can I determine which option (1-9) has the most votes?

Zenith77 10-07-2006 00:00

Re: tally votes for 9 different options
 
The first and foremost requirement is that you have a brain.

XxAvalanchexX 10-07-2006 00:15

Re: tally votes for 9 different options
 
Code:
new votes[9], i, winner; for(i=1;i<9;i++) {      if(votes[i] > votes[winner]) winner = i; }

stupok 10-07-2006 00:43

Re: tally votes for 9 different options
 
Wow! Look at that elegant bit of code! Thank you XxAvalanchexX!!!


All times are GMT -4. The time now is 04:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.