Easily integrate the Top-Games voting system to your FiveM server and reward your players in real time.
Download the latest version of the plugin from our GitHub repository.
Download v3
Extract and copy the contents of the cfx-vote-plugin
folder into your server's resources/vote
directory.
resources/vote
Get your token from the Top-Games panel.
Add the following lines to your server.cfg
file:
ensure vote
set vote_token "YOUR_TOKEN_HERE"
Enable the "Vote Plugin v3" in your Top-Games panel. You can test the plugin by clicking on "Test connectivity" and simulate a vote.
The plugin automatically triggers the onPlayerVote
event when a player votes for your server.
-- Basic usage example
AddEventHandler('onPlayerVote', function(playername, date)
print('New vote received!')
print('Player: ' .. playername)
print('Date: ' .. date)
-- Add your reward logic here
end)
-- Example with QBCore Framework
local QBCore = exports['qb-core']:GetCoreObject()
AddEventHandler('onPlayerVote', function(playerId, date)
local Player = QBCore.Functions.GetPlayerByCitizenId(playerId)
if Player then
-- Money reward
Player.Functions.AddMoney('cash', 1000, "vote-reward")
-- Item reward
Player.Functions.AddItem('lockpick', 5, false, "vote-reward")
-- Player notification
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, 'Thank you for your vote! +$1000', 'success', 8000)
-- Global message
TriggerClientEvent('chat:addMessage', -1, {
color = {255, 194, 14},
multiline = true,
args = {"[VOTE]", Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname .. " voted for the server!"}
})
else
-- Offline player handling
print("Player " .. playerId .. " not found (offline?)")
end
end)
-- Example with Qbox Framework
AddEventHandler('onPlayerVote', function(playerId, date)
local player = exports.qbx_core:GetPlayer(playerId)
if player then
-- Money reward
player.Functions.AddMoney('cash', 1000, "vote-reward")
-- Item reward
exports.ox_inventory:AddItem(player.PlayerData.source, 'lockpick', 5)
-- Player notification
exports.qbx_core:Notify(player.PlayerData.source, 'Thank you for your vote! +$1000', 'success', 8000)
-- Global message
TriggerClientEvent('chat:addMessage', -1, {
color = {0, 162, 255},,
multiline = true,
args = {"[VOTE]", player.PlayerData.charinfo.firstname .. " " .. player.PlayerData.charinfo.lastname .. " voted for the server!"}
})
else
-- Offline player handling
print("Player " .. playerId .. " not found (offline?)")
end
end)
resources/
ensure vote
line is in server.cfg
server.cfg
AddEventHandler
print()
to debugNeed help? Our team is here to assist you.