• Print

Author Topic: Making votes (votekick/voteban) count off of who voted, not the entire server  (Read 4337 times)

0 Members and 1 Guest are viewing this topic.

Offline Jerpy

  • Newbie
  • *
  • Posts: 21
  • Karma: 2
I have a question about how ULX does its default votes.
These votes when done, count all players for the server. Almost 95% of the time, if a vote is done, no action is ever taken.

Here is a quote from another player:

Quote
Right now, if there are 10 people on the server, and i start a voteban for mass rdm, and 5 people vote yes, and 5 people don't vote at all, then it counts it as 5/10 instead of 5/5. This makes it very hard to achieve any successful votes.

I feel that it should be yes versus no, not yes versus who didn't participate. This makes these votes almost useless, since no will always win. Of course, an argument could be made to that saying "maybe they just don't care and it's not an important vote."

Unfortunately that doesn't always apply. There's different factors to be considered, such as if a few people are afk or didn't notice it.

I have no idea how to change this, but does anyone know of a modification that can be made to vote.lua, or any different voting mechanisms out there that do it like this?

Thanks.
« Last Edit: July 27, 2015, 06:07:22 pm by Jerpy »

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
This is the code that determines the winning option in a vote:

Code: Lua
  1. for id, numvotes in pairs( results ) do
  2.   if numvotes > winnernum then
  3.     winner = id
  4.     winnernum = numvotes
  5.   end
  6. end

If you don't understand the code, what it does is go through all possible options. For each option, it checks if the number of votes is greater than the votes for the leading option (if there is no leading vote then it checks if the number of votes is greater than 0). If the option's votes are greater than the votes for the current leading option, the option is set as the leading option. The end result of this is that the option with the most votes wins.

This makes your example confusing,because if only 5 people vote for yes and nobody votes for no, the outcome should be that yes wins regardless of the total number of players. Maybe there were people who voted no, because otherwise there is something strange going on with your voting system.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline Jerpy

  • Newbie
  • *
  • Posts: 21
  • Karma: 2
Just realized that probably would make it confusing.

To change it up, and this is what happens; Let's say there are 10 players on the server. A votekick is issued. 4 vote yes, and nobody votes no. 6 people do not vote. The vote is denied, because 6 did not vote. What I am looking to do is have the outcome search for the amount of players that voted no, and put that against the ones that voted yes. Instead, for some reason it groups "no's and didn't vote" in the same exact category, which I am trying to prevent. That's like having an election, and let's say 1/3rd of the country votes, but the other 2/3rd doesn't so the votes don't even count and the election has to be re-done.

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Again, you must be misunderstanding how the ULX voting system works. If there are 10 people on the server, and only 4 people vote for yes, and nobody votes for no, the yes vote will win. It is simply the option with the most votes. I just tested this on my sever, just to be sure, and even if only ONE player votes (for yes) and there are 10 people on the server the yes vote will win.

It does NOT do anything with the people who didn't vote. It doesn't assign them the "no" vote, or any other vote at all! I urge you to test this again. Turn on "Echo players vote choices" and have a vote. If indeed only 4 people out of 10 vote, all for yes, and the no vote still wins then something strange is going on with your voting system because that is not how it works in unmodified ULX.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

  • Print