PS: You can activate and configure the voting plugin later if you wish in the panel of your server page.
- Download the plugin here: https://cdn.top-games.net/plugin/cfx/latest or directly on our Github page: https://github.com/Top-Serveurs/cfx-vote-plugin
- Copy the plugin in the resources/vote directory of your FiveM server
- Add in your server.cfg file the lines below:
ensure vote
# The token is mandatory. It is the token of your server page (which will be available on your panel).
set vote_token "XXXXXXXXX"
# The listening port of the plugin. Default port is 8192 but you can specify which one you want. Don't forget to configure it in the form below as well.
set vote_port "8192"
Attention: The port should free and open in UDP, it should be different from your FiveM server. This port is used to listen to the votes cast on your server page.
- Indicate the port you just configured (or the default port 8192) in the field below
- Use the onPlayerVote event for receive the votes. An example is available in the vote/example.lua file and in the example_esx.lua file for a little example with ESX (remember to delete the examples). Here's an example:
AddEventHandler('onPlayerVote', function (playername, ip, date)
-- Add actions here when a vote is received.
-- For example: give In-Game money, give points, save in DB, ...
print(playername)
print(ip)
print(date)
end)
- Start your server. If you see the message "[VotePlugin] Active voting plugin on the port you just specified", all is done!