Hi,
with the creation of my server, I wanted to add the script of ‘Vote’ of GTA Top server.
The system allows voting players to make money in play at each vote.
With each vote => Players not found (error message in the console)
At each vote => An unknown person voted for the server! (message in game).
I try everything but I can not find where the problem comes from. if someone has the solution I am a big taker!
I opened my port 8192
I configured the Config.ini
I have Pnotify
PS: In my console I see the Script launched + positive plugin test … so I really do not see where the problem is.
Sorry for my BAD English, i’m french…
Script code =>
ESX = nil
TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)local function getPlayerByName(playername)
local xPlayers = ESX.GetPlayers()
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer ~= nil and xPlayer.getName() == playername then
return xPlayer
end
end
return nil
endAddEventHandler(‘onPlayerVote’, function (playername, ip, date)
local player = getPlayerByName(playername)
if Player then
Player.addMoney(650)-- Pour notifier (requiert pNotify) : TriggerClientEvent("pNotify:SendNotification", -1, { text = ""..playername.. " a voté pour le serveur</br>Il a gagné <b style='color:green'>100$</b>", type = "info", timeout = 15000, layout = "centerRight" }) else print("Joueur introuvable !") -- Pour notifier (requiert pNotify) : TriggerClientEvent("pNotify:SendNotification", -1, { text = "Un inconnu a voté pour le serveur !", type = "info", timeout = 15000, layout = "centerRight" }) end end)