Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function voteGravDone(t)
- --local results = t.results
- --if results[0] < results[1] then
- --str = "Vote results: option 'Low' has won."
- --ulx.rcon( _, "sv_gravity 250" )
- --else
- --str = "Vote results: option 'Default' has won."
- --ulx.rcon( _, "sv_gravity 600" )
- --end
- local results = t.results
- local winner
- local winnernum = 0
- for id, numvotes in pairs( results ) 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
- if winner == 0 then
- str = "Option 'Low' has won!"
- ulx.rcon( _, "sv_gravity 250" )
- else
- str = "Option 'Default' has won!"
- ulx.rcon( _, "sv_gravity 600" )
- end
- end
- ULib.tsay( _, str ) -- TODO, color?
- ulx.logString( str )
- Msg( str .. "\n" )
- end
- function ulx.voteGrav( calling_ply )
- --if voteInProgress then
- --ULib.tsayError( calling_ply, "There is already a vote in progress. Please wait for the current one to end.", true)
- --return
- --end
- --local msg = "Change the server gravity to:"
- --ulx.doVote( msg, { "Default", "Low" }, voteGravDone, _, _, _ )
- if ulx.voteInProgress then
- ULib.tsayError( calling_ply, "There is already a vote in progress. Please wait for the current one to end.", true )
- return
- end
- ulx.doVote( "Change the server gravity to:", {"Low", "Default"}, voteGravDone )
- ulx.fancyLogAdmin( calling_ply, "#A started a vote #s", "to change the gravity" )
- end
- local votegrav = ulx.command( "Voting", "ulx votegrav", ulx.voteGrav, "!votegrav" )
- votegrav:defaultAccess( ULib.ACCESS_ALL )
- votegrav:help( "Vote to change the server gravity." )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement