Vote reward script suggestion [SCRIPT NOW AVAILABLE]

Hi ! I am the webmaster of Trackyserver.com, for those who do not know, it is a top ranking website of FiveM servers.

More and more players are voting for their favorite server and I thought a voting reward script might be interesting. The goal is to reward players in the game as soon as they vote for your server.

Since FiveM also works with steam id, this script would be easily adaptable to my voting API that my members already use for games like Ark, Rust, Unturned …

See on https://www.trackyserver.com/listing/api

I am looking for someone who masters lua to create a compatible voting script.

Thank you !

EDIT 5/11/2018

The script is available and 100% functional ! A big thank to Havoc for his work !
If you have a suggestion do not hesitate to reply to this topic or contact me on Trackyserver.com
Here is the download link: https://github.com/TGRHavoc/fivem-serverVote

4 Likes

&steamid={UserSteamID}
And what about servers that don’t force Stream (like a normal person)? You’re telling me that I wouldn’t be able to vote for my favourite server just because I don’t have/want Steam?

2 Likes

Soon it will be possible to vote simply by filling a captcha and the system will also work with a username for example:

Nice. I don’t see how this would work with a resource though, afaik you can’t “send” the captcha to the players for them to fill out. You might be able to do this but, I feel it would take a lot of effort without any real benefit. And, if you’re using a simple text-generated captcha then, you’ve missed the point of having a captcha in the first place.

And how would you stop this being abused? On FiveM anyone can change their username to anything. So, what’s to stop me from changing my name to “NotHavoc” and claiming a reward for “NotHavoc” as well as “Havoc”?
On that note, if I know 200 steamIDs, what’s to stop me from sending requests as them to vote from my server every day? Do you have a system in place for this? If yes, and it has something to do with IP checking, then I have to doubt whether this would work on this platform. You can’t send a request from the client (because of security reasons) so, all requests would be coming from the server. One IP so, an IP rate-limiter wouldn’t wok.

I get what you’re trying to do and, think it could be a cool idea. I just don’t see how this could be done without abuse from people (in particular, server owners) and with ease of use for the players.

I honestly think it’s a great idea, I am building my own server right now still far away from finishing but I will definitely implement a API however I have to do it in c# since I don’t know lua.

I mean it will be possible to vote without steam authentication.
But to receive the reward in game, the player must obligatorily connect with steam.
On most FiveM servers it is possible to recover the player’s steamid.

&username={Username} is enough for other games, not for FiveM.

Great ! I’m glad this project interests someone.
I will also create a fivem server locally and test a script we know !

The script is available ! See topic above !

I have set the keys and ids in both the server.lua, and CFG, yet the script still tells me to enter them in. Any help here?

i cant understand how edit to reward =[
someone can show me the correct script for this??

> Config.Rewards = {
>     ["@"] = { -- @ = all votes
>         "moneyadd {playerid} 3000", -- add 100 money for voting
>         "say {playername} has voted!"
>     },
>     ["10"] = { -- When the player has 10 votes
>         "moneyadd {playerid} 10000", -- Add an extra 1000 money to the player
>         "say {playername} has voted 10 times!"
>     },
>     ["100"] = {
> 	    "moneyadd {playerid} 100000",
>         "say {playername} has 100 votes!!!"
>     }
> }

I share @Havoc 's concern that this could easily be abused by a server admin that wants their server to have the most votes. What prevents an admin from sending hundreds or thousands of POST requests to your API and simply iterate the steamID or pull every steamID from their DB? Is there any sort of rate limit, or IP tracking, etc etc?

It’s simple to use, just add the commands that will execute the script one below the others.

For example if I want to give $50 when a player votes and $500 bonus when he reaches 30 votes, I will do:

>  Config.Rewards = {
>      ["@"] = {
>          "moneyadd {playerid} 50",
>          "say {playername} has voted ! Thank you ! "
>      },
>      ["30"] = {
>          "moneyadd {playerid} 500", 
>          "say {playername} has voted 30 times ! Congratulation !"
>      }
>  }

Respect the syntax of the script, pay attention to the commas.

Commands must be executable by the console. Otherwise, you will get errors.

Everything in “@” will run every vote.
Everything in “30” will execute when the player has voted 30 times.

A file votes.json will be created when you start to use the plugin, it is this file which counts the number of vote of each player. Delete it if you want to reset the counters.

Hi SaltyGrandpa, this is not the query that adds the vote, this API is used only to check if a player has voted and whether he has already received his reward.

To vote, the player must necessarily identify via steam on Trackyserver.com. Once the player has voted, his steamid is recorded in our database.

To test go to https://www.trackyserver.com/server/danskpopliferp-14904 then click on Steam vote.

2 Likes

Thanks for the clarification, that makes much more sense. I was under the impression that users were able to vote from in-game via the API.

1 Like

Well, thanks for attention…
I understood how to add the values, but not the command, I put exactly as it is here in config.lua and the player still does not receive anything for voting =/

If you receive the message “alicersg has voted!” it’s that the script works.

On the other hand the command “moneyadd” is given as an example, you must install essential and this command must be executable from the console of the server, you must certainly create it.

Before adding the commands in config.lua, test them from the server console.

In my opinion this command does not exist on your server.

You can simply specify key and id in server.lua file as in this example:

local trackyServerId = “87121”
local trackyServerKey = “62A4103cf628c550e20b928b3067f4a6”

Convar is useful if you have multiple servers.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Added the script and set the convars in the server.cfg and it said they are missing, so i did it in the server.lua and it still said it was missing. Any idea on what im doing wrong here?

1 Like

Do not use convars, follow steps here: https://www.trackyserver.com/listing/api at the bottom of the page