Functions/DarkRP/Server/createVote

From Official DarkRP Wiki
Jump to navigation Jump to search
Function
Function name DarkRP.createVote(string question, string voteid, Player target, number delay, function callback, table excludeVoters, function fail, any ...)
Description:
Create a vote.
Returns: table vote
Part of Library: DarkRP
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=Functions/DarkRP/Server/createVote]DarkRP.createVote[/url][/b]

Function parameters

  1. question (string)
  2. The question to ask in the vote.

  3. voteid (string)
  4. A unique vote id.

  5. target (Player)
  6. Whom the vote is about.

  7. delay (number)
  8. For how long the player will be able to answer.

  9. callback (function)
  10. The function that gets called after the vote.

  11. excludeVoters (table) (optional)
  12. The players to exclude from voting.

  13. fail (function) (optional)
  14. A callback for when the vote fails.

  15. ... (any) (optional)
  16. Any other information. If the vote involves multiple parties (i.e. the target of the vote and person who started it are different) you should provide a table with the "source" field set to the player who intiated the vote. This ensures the notifications about the vote are sent to the correct player.


Function return values

  1. vote (table)
  2. All the vote information. Returns nil if the vote did not start because the canStartVote hook blocked it.