Add a server

All plugins for your servers

Plugins

FiveM (Grand Theft Auto) voting plugin

Our plugin automatically detects when a player votes for your server on our site. You can choose the type of reward he receives after he votes. It can be a small cash prize, an item in the game or something else. Our plugin is compatible with all versions of FiveM and ESX servers.

  • 1. Download the voting plugin: Fivem Plugin (ZIP or RAR)
  • 2. By unzipping the file, a sp-vote folder will be created.
  • 3. Open the file sp-vote/config.lua and complete Config.Token with the token* of your server. Complete after Config.MoneyEarned with the amount of money for each vote.
  • 4. Run the SQL file sp-vote/votehistory.sql in PhpMyAdmin or HeidiSQL. The votes will be saved in this table.
  • 5. Change the code for sp-vote/server/main.lua to reward your players after they have made a vote. For example, use the code xPlayer.addMoney(Config.MoneyEarned) to give the user a cash prize with the amount specified in Config.MoneyEarned each time they vote.
  • 6. Drag and Drop sp-vote in the server-data/resources folder of your FiveM server.
  • 7. Add the text start sp-vote to activate the plugin in your server.cfg at the bottom.

* To retrieve the Token, log on to the site > You are redirected to the list of your servers > Click on Integration at the right of the relevant server.
No need to open a connection port, we do not send UDP requests. Our plugin calls our API and updates the list of voters every 30 seconds.

Structure of the table "voteInfo"

Structure of the table "voteInfo".

{
  ip string
  time number
  pseudo string (optional)
  playerId number (not in newVoteOffline)
}

Sample code to reward players

Here is a snippet of code to reward your players for their votes.


AddEventHandler('sp-vote:newVote', function(voteInfo)
  print(('New Vote - IP : %s - Time : %s - Pseudo : %s - PlayerID : %s'):format(voteInfo.ip, voteInfo.time, voteInfo.pseudo, voteInfo.playerId))
  local xPlayer = ESX.GetPlayerFromId(voteInfo.playerId)
  xPlayer.addMoney(Config.MoneyEarned)
end)


AddEventHandler('sp-vote:newVoteOffline', function(voteInfo)
  print(('New Vote - IP : %s - Time : %s - Pseudo : %s'):format(voteInfo.ip, voteInfo.time, voteInfo.pseudo))
end)