# QBCore job definitions and assignment

Define a job in `qb-core/shared/jobs.lua`, then assign it through a permission-checked server command.
A job definition provides grades and pay; it does not install gameplay, uniforms, garages or a boss menu.
This page is source-reviewed against the pinned upstream below, not a FiveM runtime test report.

## Job definitions

Add this entry inside the existing jobs table in `qb-core/shared/jobs.lua`:

```lua
['docs_tow'] = {
    label = 'Documentation Tow Example',
    defaultDuty = false,
    offDutyPay = false,
    grades = {
        ['0'] = { name = 'Rookie', payment = 50 },
        ['1'] = { name = 'Driver', payment = 75 }
    }
},
```

Grade keys are strings. Upstream uses `name` and `payment`, not `label` and `salary`, for the grade.
The pay amounts are example economy values. Restart the affected server resources in staging to
load changed definitions; a console `refresh` only rescans resource manifests.

## Assigning a job

Use the built-in command from an account configured with the required administrative permission:

```text
/setjob 7 docs_tow 0
```

`7` is a connected player's server ID; substitute the actual target ID. Do not expose an unrestricted
`CreateCallback` or `RegisterNetEvent` that changes a player's job. A client can invoke a callback
directly, so a menu or hidden button provides no authorization.

For custom administrative assignment, follow the server-side permission and grade validation in
[set job safely](/docs/guides/set-job). Configure access using [admin permissions](/docs/guides/how-to-become-admin).

## Going on duty

If your job resource already provides a duty interaction, use that interface. For a development
command, place this in a **client** script:

```lua
RegisterCommand('docs_duty', function()
    TriggerServerEvent('QBCore:ToggleDuty')
end, false)
```

This requests the core duty toggle; it does not grant a job. Sensitive job actions still need their
own server-side job, grade, duty and location checks. See [server event security](/docs/security).

## Verification

- Run `/job` on the assigned character to inspect the job, grade and duty state at the pinned revision.
- Run `/docs_duty`, then `/job` again and confirm that the duty value changes.
- Verify job updates reach your actual job resource and test logout/reconnect persistence in staging.
- Confirm an account without assignment permission cannot use `/setjob`.

The shared job grade has `payment`; the resolved Player job exposes pay under `job.grade.payment`
at this revision. Don't assume a different fork or older core has the same Player data shape.

## See also

- [Create a job resource](/docs/guides/create-job)
- [Player data lifecycle](/docs/core/player-data)
- [QBCore shared jobs source](https://github.com/qbcore-framework/qb-core/blob/9b3cddcce93e5e12cbcf6b47b866b687d32ac7bf/shared/jobs.lua)
- [Player job resolution](https://github.com/qbcore-framework/qb-core/blob/9b3cddcce93e5e12cbcf6b47b866b687d32ac7bf/server/player.lua)
- [Commands and permissions](https://github.com/qbcore-framework/qb-core/blob/9b3cddcce93e5e12cbcf6b47b866b687d32ac7bf/server/commands.lua)
- [Core duty handler](https://github.com/qbcore-framework/qb-core/blob/9b3cddcce93e5e12cbcf6b47b866b687d32ac7bf/server/events.lua)

## Next steps

Explore [permissions](/docs/guides/how-to-become-admin) and [core concepts](/docs/core-concepts).
