> For the complete documentation index, see [llms.txt](https://fragmentdevelopment.gitbook.io/fivem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fragmentdevelopment.gitbook.io/fivem/paid-scripts/multijob.md). Agents can also search and read this documentation through its [MCP server](https://fragmentdevelopment.gitbook.io/fivem/~gitbook/mcp).

# MULTIJOB

A custom-designed, elegant, and precise FiveM server script for switching between your jobs with ease.

[Download here](https://github.com/cassanodev/cs_multijob)

YouTube Showcase Video

***

## Compatibility

* ESX
* QBCore
* QBOX

***

## Installation

{% stepper %}
{% step %}

### Step 1 - Download

1. Download our resource
2. Unzip the `cs_multijob.zip` folder and place this folder in your server's resource folder.
3. Add the resource to your server start config (server.cfg). Make sure `cs_multijob` is listed below your framework resource e.g., es\_extended, not above it.
   {% endstep %}

{% step %}

### Step 2 - Configuration

You **must** read all configurable options inside `[cs_multijob/shared/config.lua]` and adjust them to fit your server's needs. Please pay attention to the commented texts at the end or above of each line to understand the purpose of each config option.

1. Framework. By default, it is set to 'auto' to auto-detect whether you're using ESX or QBCore.
2. Database. By default, auto sql is set to true, meaning you don't need to run SQL queries manually. If necessary, there's a database.sql file in the script root.
   {% endstep %}
   {% endstepper %}

***

## Setting up Discord features

### Set your bot token

You'll need to set this in order to get discord features to work with our script. Follow this guide carefully step-by-step to get it to work properly.

1. Set up a Discord bot via the developer portal on Discord. (<https://discord.com/developers/applications>)
2. Invite the Discord bot you created to your Discord.
3. Get the Discord bot token from the newly created bot.
4. Place the Discord bot token in `Config.JobsLimits.Discord.bot_token = 'BOT_TOKEN',` in the `shared/config.lua` file.
5. Get your Guild ID(s) by copying the ID of your Discord server's logo in the sidebar of Discord. If you don't see the option to copy the Guild ID, enable the developer mode in settings.
6. Place the Guild ID(s) in `Config.JobsLimits.Discord.guilds,` in the `shared/config.lua` file.

### Configuring Auto-Management

In the `Config.JobsLimits.Discord.autoManagement` section in the `shared/config.lua` file you'll find the following options:

```lua
autoManagement = {
    enabled = false, -- Enable this to automatically manage players jobs based on their discord roles
    addJobIfRole = false, -- Add job to player if they have the role
    removeJobIfNoRole = false, -- Remove job if player doesn't have the role
    checkTime = 60, -- Time in seconds to check for the role, the thread will only be active if Config.JobLimits.Discord.removeIfNoRole == true
    overrideLimits = false, -- If true, the jobs will be added even if the player already has the max amount of jobs
    createThreadPerPlayer = true, -- If set to true, a new thread will be created to handle each player's information, but this may fail in some cases due to Discord policies. If it doesn't work properly, set it to false. If set to false, a single thread will handle one player after another, which will be somewhat slow but effective

    roles = {
        -- FORMAT:
	-- [discord_role_id: string] = { jobName: string, jobLabel: string }

	    ["000000000000000000"] = { job = "police", grade = 1, },
	    ["000000000000000001"] = { job = "ambulance", grade = 1, },
    }
}
```

There you'll find comments after almost every line explaining what those lines do.

To set up a job with a role, go to your server, right-click on the desired role and click Copy Role ID and add it in quotes to the list of roles as in the example there.
