Hi there Guest,  
Sign in here: Login through Steam



  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Needs Fixing

#5
(04-29-2015, 11:57 PM)Brassx Wrote:  Dunno.

ULX has always been weird, but the code looks like it should work:


PHP Code:
local function voteDone)
 
local results t.results
 local winner
 local winnernum 
0
 
for idnumvotes in pairsresults ) do
 if 
numvotes winnernum then
 winner 
id
 winnernum 
numvotes
 end
 end

 local str
 
if not winner then
 str 
"Vote results: No option won because no one voted!"
 
else
 
str "Vote results: Option '" .. t.optionswinner ] .. "' won. (" .. winnernum .. "/" .. t.voters .. ")"
 
end
 ULib
.tsay_str ) -- TODOcolor?
 
ulx.logStringstr )
 
Msgstr .. "\n" )
end 

It gets the voting option that had the most amount of votes, so not sure why 6 would beat 7, unless it counted the players that did not vote too.

Yeah it must count the players that didn't vote. Is it possible to not count those or maybe an easier way is to count them as no that way it wont say 6/13 is winning? This way the vote simply won't pass.
Find
Reply



Messages In This Thread
Needs Fixing - Jake1o - 04-29-2015, 11:46 PM
RE: Needs Fixing - Terran - 04-29-2015, 11:54 PM
RE: Needs Fixing - Aresuft - 04-29-2015, 11:56 PM
RE: Needs Fixing - Brassx - 04-29-2015, 11:57 PM
RE: Needs Fixing - Jake1o - 04-30-2015, 12:23 AM
RE: Needs Fixing - Brassx - 04-30-2015, 01:27 AM
RE: Needs Fixing - Jake1o - 04-30-2015, 03:23 AM
RE: Needs Fixing - Terran - 04-30-2015, 01:30 AM
RE: Needs Fixing - Terran - 04-30-2015, 03:32 AM

Forum Jump:


Users browsing this thread:
5 Guest(s)