Author Topic: Help with a custom ULX vote  (Read 2189 times)

0 Members and 1 Guest are viewing this topic.

Offline Rex744

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Help with a custom ULX vote
« on: April 05, 2017, 07:42:46 PM »
Code: [Select]
function ulx.difficulty( calling_ply, title, ... )
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( title, { ... }, voteDone )
ulx.fancyLogAdmin( calling_ply, "#A started a vote to set the server difficulty (#s)", title )
end

local vote = ulx.command( CATEGORY_NAME, "ulx difficulty", ulx.vote, "!difficulty" )
vote:addParam{ type=ULib.cmds.StringArg, "title" }
vote:addParam{ type=ULib.cmds.StringArg, "options", ULib.cmds.takeRestOfLine, repeat_min=2, repeat_max=10 }
vote:defaultAccess( ULib.ACCESS_ADMIN )
vote:help( "Starts a public vote to change the server difficulty." )

Is there a way to make this have a predifined title, predifined options and if option succeeds then, so when someone does ulx difficulty a vote starts with the predifined stuff I want?

I cannot find any tutorial on the entire internet, and to make things worse there is no gmod lua custom vote tutorial online either, when I search it up all I see are map vote addons.

Edit: I posted a job on scriptfodder for this task:
https://www.gmodstore.com/jobs/view/16689
« Last Edit: April 06, 2017, 04:16:47 PM by Rex744 »

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given