[RELEASE] [ESX] esx_discordjobs - ESX Job selector with Discord Whitelist

An ESX Job Selector with Discord Whitelist

FiveM ESX script that allows players to take jobs, using Discord roles to whitelist these jobs. Also can take away jobs (and set the player back to a default job) if they lose the required Discord roles.

I intend to make something better (and probably paid) in the future that has a UI and designated job selection locations, but this is what I accomplished today and it works quite well! Enjoy.

Configuration Options

You define “Job Names” with associated ESX jobs and grades in config.lua along with a list of Discord roles. You can also define if you want the user to have all of the roles in your list or only one of the roles in the list. Note: You must list all jobs (including unemployed) here if you want the user to be able to select them using this script. The command (/takejob in the screenshots) is also configurable.

Prerequisites

You must have discordroles configured and started for this resource to work.

This resource was built and designed for ESX Legacy

Use

  • Place esx_discordjobs in your server resources.
  • Edit config.lua with your desired jobs and roles.
  • Add start esx_discordjobs to your server.cfg.

Use In Other Resources

Includes two exports that can be used in other resources as shown below…

-- Check Job Permissions - returns true if they have permission to have the job, false otherwise
exports['esx_discordjobs']:checkJobPermissions(playerIdentifier, esxJobName, esxJobGrade, function(result)
  print(result)
end)
-- Set Job - sets the player job checking that they have permission to do so
-- Returns true if they had permission for and now have the job, false otherwise
exports['esx_discordjobs']:setJob(playerIdentifier, esxJobName, esxJobGrade, function(result)
  print(result)
end)

Note: Remember that the jobs and grades must be defined in Config.jobRoles for these to work.

License

This resource/script/modification is provided free of charge. No warranty is provided in any form. Any responsibility for damages caused by this resource rest solely with the user. The author(s) of this script accept no liability. By using this resource, you agree to the following terms…

  • The license must remain unmodified and in its original state, installed with the resource in your server.
  • You may not redistribute, modify and redistribute, or claim this work as your own. Any modifications you make to this resource must be for personal use only.

Contributing

If you want to contribute, simply send in a pull request on the GitHub Repository

Screenshots

Take Job Command - Configurable


Message when Job is Selected
Message when Job is Selected
Message when Job does not exist in config

Message when user does not have permission to take the job (They don’t have the required Discord role(s))

Thank you and enjoy!

Download: esx_discordjobs - Created By Clink123

5 Likes

but isnt there a problem using multicharacter? you can choose it on every character or what?

I’m using multichar and it works fine. Not sure why there would be an issue. If you find one let me know.

1 Like

i was thinking people can police on one character and then just go into their other characters and use it again, so they can troll around, or is it locked?

The script uses ESX player identifiers and then sets the job, checking Discord roles as a whitelist. You can view the source code as it’s all there… if you use different esx identifiers for each character (as you should be and as multi character scripts do) then you’ll have no issue. Before commenting a concern I suggest testing it. Thanks.

1 Like

Release Version 0.2.0

  • Added automatic job removal if a user no longer has the required roles
  • Added exports to be used in other scripts
  • Added config option to disable the chat commands (only exports can then be used)

You may have misconfigured your config. Try starting over.

Everytime i type /takejob it says the job does not exist in the server?

work with qbcore?

ESX only