[RELEASE] [ESX] DiscordDonatorPerks

Further documentation (including updates) of this script will be located at DiscordDonatorPerks - Badger Docs

DiscordDonator Perks

What is it?

DiscordDonatorRanks is a script I made for my server to give some perks to players who were part of the Tebex/Patreon subscription helping to keep us paying for the server. I wanted to give something to those players every month, but didn’t want extra work for my staff to have to do. So, with DiscordDonatorRanks, it essentially automates the process of giving money and/or jobs in-game to players depending on their discord roles. It’ll then save them to the database and they will not be able to access the perks for another 30 days (essentially a whole month, maybe down the line I’ll make it an official month no matter what month it is). It’s a quite simple script and I’m honestly surprised I haven’t found one like it.

Images

Requirements

Installation

  • Find the insert.sql file and insert its code into your essentialmode database. (The same database you are using for ESX)

Insert.sql:


CREATE TABLE IF NOT EXISTS Donator_Data

(

id INTEGER(11) AUTO_INCREMENT PRIMARY KEY,

identifier VARCHAR(50),

playerName VARCHAR(50),

dateReceiveNext INTEGER(64),

acceptedPerkID INTEGER(11),

rankPackage VARCHAR(50)

);

  • After setting up the Donator_Data table within your database, you will then want to move onto configuring discord_perms and DiscordDonatorPerks configs

Configuration

roleList = {

{"Bronze-Tier", 1, {"$1,000,000 voucher", {'Money', 1000000}}

}, -- Bronze Tier

{"Silver-Tier", 1, {"$5,000,000 voucher",{'Money', 5000000}}

}, -- Silver Tier

{"Gold-Tier", 1,

{"$15,000,000 voucher",{'Money', 15000000}},

{"Invitation to Mafia [Gang]", {'Job', 'mafia', 0}},

{"Invitation to LS Kings [Gang]", {'Job', 'woodyguns', 0}},

{"Invitation to Sons of Anarchy [Gang]", {'Job', 'lazy', 0}},

{"Invitation to Black Diamond Cartel [Gang]", {'Job', 'stevestacos', 0}}

}, -- Gold Tier

}

  • It’s now time to understand how the configuration works

  • {"$1,000,000 voucher", {'Money', 1000000}} is what I like to call a Offer

  • Offers are basically what the player will be offered in-game on their character to accept or deny

  • The Offers can be seen above in Images in which it asks the player whether they want to accept or reject

  • How do we set up a job for Silver Tier ?

    • We first need to set it up correctly, so we need to add another Offer to it

    • You’ll notice below that we added a job to Silver Tier simply by adding the , and correct format of jobs being {"Invitation to Job", {'Job', 'jobname', 0}}

    • "Invitation to Job" is known as the Label and will be displayed on the player’s screen asking if they want to accept or reject it

    • {'Job', 'jobname', 0} is known as the Job-Details in which the script will use to give them the job if they accept it

    • 'Job' is the identifier of what type of Offer it is

    • 'jobname' is the name of the job (the one you use to set players to work for it)

    • 0 is known as the Job-Grade in which is the level of the job they will obtain when accepting the Offer

{"Silver-Tier", 1,

{"$5,000,000 voucher",{'Money', 5000000}},

{"Invitation to Job", {'Job', 'jobname', 0}}

}, -- Silver Tier

  • How do we set up another money voucher for Silver Tier ?

    • We once again need to add another Offer to it

    • You’ll notice below we have the Label as "$100,000 voucher"

    • We have the Money-Details as {'Money', 100000}

{"Silver-Tier", 1,

{"$5,000,000 voucher",{'Money', 5000000}},

{"Invitation to Job", {'Job', 'jobname', 0}},

{"$100,000 voucher", {'Money', 100000}}

}, -- Silver Tier
  • We want to replace the 1 s within the server.lua with the roleIDs of the corresponding rank you want in that spot

  • If you’re familiar with my work, the roleList should come as no surprise to you lol…

  • Note: Currently (as of version 1.0), accepting and denying jobs will put the job in the database because we don’t want it asking them for joining the jobs every other time they login. In the future I’ll hopefully make a command such as /select for selecting a job from where they got invitations to, so they can switch.

  • Another Note: What this means is, when the player first logins, they need to select the character they want the job on first (if they have a job perk), then accept it and deny the others on it. If they want the money on another account, they can just deny it and accept it the next time they login with the other character.

Download

21 Likes

This is cool and well documented. Thank you for the release.

The job change is neat. Can set up a patron shop based off their jobs so they can buy x item/car at y subscription level.

3 Likes

Thank you for the kind comment! I always try to keep my documentation on point! For the future features, I may enable removing the job from the user if they no longer have the patreon role. I also want to look into having a command such as /redeem or such to reselect a job from the list of ones they are allowed for their perk (essentially allowing them to join Whitelisted jobs themselves by just having the patreon role that corresponds with those jobs).

Hope you enjoy! :slight_smile:

2 Likes

I might be wrong… Sorry if I am… But isn’t people paying for Ingame benefits against TOS?

1 Like

Technically purchasing them is, however this is to be thought of as a perk they get for supporting the server. What you do with this script is up to your discretion, not mine. I’m not liable for how any of you use it despite if it’s used against the TOS or not.

Hopefully that clears things up.

Also, I don’t think it’s particularly against the TOS. I’ve read the TOS and never mentioned anywhere that they are against perks and that it’s not allowed. Maybe it’s frowned upon, but that doesn’t mean you can’t do it. You just can’t profit off of FiveM, that’s the huge thing.

As long as donations don’t exceed immediate server costs it’s allowed. You just can’t make a profit from it.

1 Like

I don’t play ESX anymore but I can say that this is a certified hood classic :sunglasses:

Great release Badger :fire:

2 Likes

Every time I insert it into my database it comes up with this


How do I fix this?

Whoops forgot to delete that ,

Use this instead:

CREATE TABLE IF NOT EXISTS Donator_Data 
(
	id INTEGER(11) AUTO_INCREMENT PRIMARY KEY,
	identifier VARCHAR(50),
	playerName VARCHAR(50),
	dateReceiveNext INTEGER(64),
	acceptedPerkID INTEGER(11),
	rankPackage VARCHAR(50)
);

make it for non esx servers

How? What features?

1 Like

like they can get different tiers and depending on what tier they have they can drive certain vehicles for that donator tier as well as the vehicles from the tier below it

1 Like

What are the chances of you working on a DiscordQuePerms in a script <3 my stuff all works through your scripts on discord so why not <3

idk if its just me but i cant see in the installation how to connect the DiscordDonatorPerks to link with the discord perms

it would be great when donaturs on their first login, they get a car, is that possible ?

Um it would need to be added to the script, so maybe someone can in the future. My server is changing from ESX, so I probably won’t release much more ESX scripts any more sadly…

1 Like

Nooooooooo
stay on esx
and also
insert.sql is a little bit messed up as it creates “Tebex_Data” table but it should be “Donator_Data” instead, am I wrong? =D

Ye you may have to change that yourself, whoops

whats bot and guild id ?

I keep getting this error

SCRIPT ERROR: @DiscordDonatorPerks/server.lua:151: attempt to index a nil value (global 'ESX')

It’s starting to drive me crazy because it’s the only script from Badger that isn’t cooperating :c

Thanks in advance!

1 Like