Advertisement
Guest User

Untitled

a guest
Jan 9th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. local results = t.results
  2.     local winner
  3.     local winnernum = 0
  4.     for id, numvotes in pairs( results ) do
  5.         if numvotes > winnernum then
  6.             winner = id
  7.             winnernum = numvotes
  8.         end
  9.     end
  10.  
  11.     local str
  12.     if not winner then
  13.         str = "Vote results: No option won because no one voted!"
  14.     else
  15.         str = "Vote results: Option '" .. t.options[ winner ] .. "' won. (" .. winnernum .. "/" .. t.voters .. ")"
  16.     end
  17.     ULib.tsay( _, str ) -- TODO, color?
  18.     ulx.logString( str )
  19.     Msg( str .. "\n" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement