# Exports

{% tabs %}
{% tab title="Client" %}

#### openMenu()

> Trigger this export to open the multi job menu.

```lua
exports['av_multijob']:openMenu()
```

{% endtab %}

{% tab title="Server" %}

#### setJob(playerId,job,grade,onDuty)

> Assigns a job to the specified player and sets it as current. It automatically checks the configured job limit, granting the job only if the player hasn't reached their maximum allowed jobs.
>
> **params:**
>
> * **playerId**:`number|string` Player server id or Player Framework identifier
> * **job**:`string` Job name
> * **grade**:`number` Job grade
> * **onDuty**:`boolean` Duty status
>
> **returns:**
>
> * **response**:`boolean`&#x20;
>
> ```lua
> local playerId = 3
> -- playerId could also be the player framework identifier:
> -- playerId = "char1:abc1234567687"
> local job = "police"
> local grade = 0
> local onDuty = false
> local applied = exports['av_multijob']:setJob(playerId,job,grade,onDuty)
> print(applied)
> ```

#### deleteJob(playerId,job)

> Removes the job from the specified player.
>
> **params:**
>
> * **playerId:** `number|string` Player server id or Player Framework identifier.
> * **job**:`string` Job to remove
>
> **returns:**
>
> * **response**: `boolean`
>
> ```lua
> local playerId = 3
> -- playerId could also be the player framework identifier:
> -- playerId = "char1:abc1234567687"
> local job = "police"
> local removed = exports['av_multijob']:deleteJob(playerId,job)
> print(removed)
> ```

### addJob(playerId,job,grade)

> Adds the specified job and grade to the player without changing their currently active job.
>
> **params:**
>
> * **playerId**: `number|string` Player server id or Player Framework identifier.
> * **job**:`string` Job name
> * **grade**:`number` Job grade
>
> **returns:**
>
> * **response**:`boolean`
>
> ```lua
> local playerId = 3
> -- playerId could also be the player framework identifier:
> -- playerId = "char1:abc1234567687"
> local job = "police"
> local grade = 0
> local added = exports['av_multijob']:addJob(playerId,job,grade)
> ```

#### setJobGrade(playerId,job,grade)

> Updates the specified player job grade to the new desired rank.
>
> **params:**
>
> * **playerId**:`number|string` Player server id or Player Framework identifier.
> * **job**:`string` Job name
> * **grade**:`number` Job grade
>
> **returns:**
>
> * **response**:`boolean`
>
> ```lua
> local playerId = 3
> -- playerId could also be the player framework identifier:
> -- playerId = "char1:abc1234567687"
> local job = "police"
> local grade = 1
> local updated = exports['av_multijob']:setJobGrade(playerId,job,grade)
> ```

#### getJobPlayer(job)

> Returns a table with all job employees.
>
> **params:**
>
> * **job**:`string` Job name
>
> **returns:**
>
> * **employees**:`table[]` An array of employees, where each entry contains the following data:
>   * **identifier**:`string` Player identifier
>   * **name**:`string` Player full name
>   * **grade**:`number` Player grade
>
> ```lua
> local employees = exports['av_multijob']:getJobPlayers("police")
> print(json.encode(employees, {indent = true}))
> --[[
>     Will print something like this:
>     {
>         {
>             identifier = "abc123",
>             name = "Employee 1",
>             grade = 1
>         },
>         {
>             identifier = "char1:2929292",
>             name = "Employee 2",
>             grade = 0
>         },
>         -- .... and so on
>     }
> ]]--
> ```

{% endtab %}
{% endtabs %}
