Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pages/multijobs/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export default {
description: "Description",
installationguide: "Installation guide",
faq: "Frequently asked questions",
devdocs: "Developer documentation"
installationguide: "Installation Guide",
configurationguide: "Configuration Guide",
upgrading: "Upgrading from v2",
faq: "Frequently Asked Questions",
devdocs: "Developer Documentation"
};
193 changes: 193 additions & 0 deletions pages/multijobs/configurationguide.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
import { Callout } from "nextra/components";

# Configuration Guide

Everything you can change lives outside escrow, in these folders of the resource:

| Path | What it holds |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `config/general.lua` | Language, framework, how the hub opens, LB-Phone app, default job, job limit, cooldown, duty, Team page, staff, currency |
| `config/jobs.lua` | Icon and colour per job, locked and blocked jobs, exclusive groups |
| `config/server.lua` | Logs and switch checks. Only the server reads this file, so the webhook stays private |
| `locales/*.json` | All texts, one file per language |
| `theme/tokens.css` | Colours, sizes, spacing and corners of the hub |
| `bridge/` | Framework support (see the [Developer Documentation](/multijobs/devdocs#frameworks)) |

Restart the resource (`ensure zerio-multijobs`) after changing a config file.

## Opening the hub

```lua
Config.open = {
command = 'jobs', -- /jobs opens the hub, /jobs <job> switches
key = 'F4', -- FiveM only; players can rebind it in the game's key settings
item = false, -- the name of an item that opens the hub when used
}
```

Set any of them to `false` to turn it off. Other resources can open the hub with `exports['zerio-multijobs']:Open()` (client), for example from a radial menu.

## Jobs and limits

| Setting | Default | What it does |
| ----------------------- | ------- | ------------------------------------------------------------------------------- |
| `Config.maxJobs` | `3` | Jobs a player may hold, not counting the default job. `false`: no limit |
| `Config.extraSlots` | `{}` | Extra slots by ACE or framework group, for example `['zeriomultijobs.vip'] = 2` |
| `Config.defaultJob` | `nil` | The job players have when they have none. `nil`: the framework's (`unemployed`) |
| `Config.showDefaultJob` | `true` | Show "Off work" in the hub: keep every job but work none |
| `Config.switchCooldown` | `30` | Seconds between switches. `0`: no wait |
| `Config.currency` | `'USD'` | Currency salaries are shown in (an ISO code: USD, EUR, SEK, ...) |

<Callout type="info">
On **Qbox**, qbx_core has its own limit: set `setr qbx:max_jobs_per_player` to
at least `Config.maxJobs` plus your extra slots. The lower of the two applies.
See the [Installation Guide](/multijobs/installationguide).
</Callout>

When a boss menu or another resource hires a player into a job that breaks a rule (too many jobs, or an exclusive group), the new job is kept and the oldest job that breaks the rule is removed. Locked jobs are never removed this way, and the player is told which job went.

## Jobs

`config/jobs.lua` sets how each job looks, and rules for single jobs:

```lua
Config.jobs = {
police = { icon = 'shield', color = '#5aa9ff', locked = true },
mechanic = { icon = 'wrench', color = '#ffb35a' },
off_police = { blocked = true },
}
```

| Field | What it does |
| --------- | ----------------------------------------------------------------------------------- |
| `icon` | A built-in icon, or an image URL (`https://...` or `nui://...`) |
| `color` | The accent colour of the job's icon |
| `locked` | Players cannot quit it themselves. Bosses, staff and boss menus still can |
| `blocked` | Never added to the list, for example an off-duty job some scripts switch players to |

Built-in icons: `briefcase`, `shield`, `badge`, `cross`, `flame`, `wrench`, `car`, `truck`, `taxi`, `utensils`, `coffee`, `scales`, `newspaper`, `home`, `store`, `leaf`, `fish`, `hammer`, `music`, `star`, `skull`. Jobs that are not listed get `Config.defaultIcon`.

**Exclusive groups**: a player may hold at most one job from each group.

```lua
Config.exclusive = {
{ 'police', 'sheriff', 'ballas', 'vagos', 'families' }, -- law or a gang, not both
}
```

## Duty and hours

```lua
Config.duty = {
enabled = true, -- the duty toggle, and hours counted while on duty
keepPerJob = false, -- true: each job remembers its duty when switching away
key = false, -- a key that toggles duty without opening the hub (FiveM), e.g. 'F6'
}
```

Hours are counted per job while on duty, saved every five minutes and when a player leaves, and shown for this week (from Monday) and in total. ox_core and VORP have no duty: there, hours count while the job is the active one.

## Team page

Bosses open the Team page from their job's card. It shows:

- **The team at a glance**: how many are on duty, and the hours worked this week and last week.
- **Every member**, online or not, with role, status and hours this week. Sort by status, role or hours; a search field appears for larger teams. Members not seen for `inactiveDays` are marked **Inactive**.
- **A page per member**: hire date, when they were last online and last on duty, and their hours for the last eight weeks.
- **Recent activity**: hires, departures, role changes and duty, newest first.

Bosses can **hire** a nearby player (the player gets a job offer to accept or decline), **change the role** of anyone below their own role, **clock out** a member who forgot to go off duty, **fire**, and **message** everyone on duty in the job.

```lua
Config.boss = {
enabled = true,
minGrade = { police = 3 }, -- besides the framework's boss grades: who else sees it, per job
menuEvent = false, -- a client event that opens your boss menu, e.g. 'qb-bossmenu:client:OpenMenu'
hire = {
enabled = true,
range = 10, -- metres from the boss; false: any player online
offerSeconds = 120, -- how long an offer stays open
},
clockOut = true,
message = {
enabled = true,
cooldown = 30, -- seconds between messages per boss
},
inactiveDays = 14, -- false: never mark members inactive
activityDays = 30, -- how long recent activity is kept
}
```

With `menuEvent` set, the Team page shows an "Open boss menu" button for money and society. The event is triggered on the client with the job name. On Qbox and QBCore, `qb-bossmenu:client:OpenMenu` opens qbx_management's and qb-management's menu.

An offer follows the same rules as any other hire: the job limit, exclusive groups and blocked jobs. A boss only hires into roles below their own.

## Staff

```lua
Config.admin = {
ace = 'zeriomultijobs.admin',
group = 'admin', -- framework staff group (QBCore/Qbox permission, ESX group, ...)
}
```

Staff open Staff tools from the key icon in the hub: pick an online player, see their jobs, remove one, or give a job and grade. The commands do the same from the chat or the server console:

```
/givemultijob <player id> <job> [grade]
/removemultijob <player id> <job>
```

## Switch checks

In `config/server.lua`:

```lua
Config.blockSwitch = {
dead = true, -- dead or downed
cuffed = true, -- handcuffed (Qbox, QBCore and RSG)
inVehicle = false, -- sitting in any vehicle
}
```

These stop switching and quitting. For anything else (in jail, in a heist, ...), return `false` and a message from `Config.canSwitch`:

```lua
Config.canSwitch = function(source, from, to)
if Player(source).state.inJail then
return false, 'You cannot switch jobs in jail'
end
return true
end
```

## Logs

In `config/server.lua`:

| Setting | What it does |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.webhook` | A Discord webhook URL: one message per hire, fire, role change, switch, duty change and staff action. `''`: off |
| `Config.oxLogger` | `true` sends the same entries through ox_lib's logger, to Datadog, Grafana Loki or Fivemanage, whichever your server set with `set ox:logger` |

## LB-Phone

```lua
Config.lbPhone = {
enabled = true,
defaultApp = true, -- on every phone; false: players install it from the App Store
price = 0, -- App Store price when defaultApp is false
}
```

The app is added when lb-phone runs. It shows the Jobs and Team pages and follows the phone's light or dark mode. Staff tools stay in the hub.

## Languages

`Config.locale` picks a file in `locales/`: `en`, `de`, `es`, `fr`, `pt` (Brazil), `it`, `nl`, `pl`, `sv`, `da`, `no`, `fi`, `cs`, `tr`.

To change a text, edit it in your language's file. To add a language, copy `locales/en.json` to `locales/<code>.json`, translate the values (keep the placeholders in curly braces as they are), and set `Config.locale` to the new code. Any text missing from a file falls back to English.

## Theme

`theme/tokens.css` holds every colour, size, spacing and corner of the hub: its width and height, the glass tint, text colours, the accent colour and more. It is loaded after the built-in styles, so anything set there wins. The names follow Zerio Chat's, so a chat theme carries over by swapping the `--zc-` prefix for `--zm-`.
59 changes: 46 additions & 13 deletions pages/multijobs/description.mdx
Original file line number Diff line number Diff line change
@@ -1,20 +1,53 @@
import { Cards, Callout } from "nextra/components";
import { VideoIcon } from "@radix-ui/react-icons";

# Description

Why force your players to only have one job? With this script they can have **multiple**. The limit is set by you as the owner.
zerio-multijobs lets every character hold several jobs and switch between them from one job hub. Players go on and off duty, see the hours they worked this week and who is on shift, and bosses manage their team. It works with the boss menu you already use: hires, promotions and fires from qb-management, qbx_management, esx_society or any other resource show up on their own, with no edits to other resources.

It looks like the rest of Zerio's scripts: a frosted-glass panel over the game, and an LB-Phone app in the phone's own light or dark look.

## Key Features

### For players

- **Several jobs per character**, switched in one click, with a cooldown you set
- **Duty per job**: a toggle in the hub, and an optional key
- **Hours on duty**: per job, this week and all time, kept across restarts
- **Colleagues**: how many hold each job online, and how many are on duty
- **Off work**: keep every job but work none of them
- **Quit a job** yourself (unless you lock it)
- **`/jobs`** opens the hub, **`/jobs <job>`** switches straight away, with the player's jobs as choices in [Zerio Chat](/chat/description)
- **LB-Phone app** with the Jobs and Team pages

<br />
### For bosses

<Cards.Card
icon={<VideoIcon />}
title="Preview"
href="https://youtu.be/Z6aVf3uD_T0"
arrow
/>
- **Team page**: every employee of the current job, online or not, with role, duty and hours this week; the team's hours this week and last week; sorting, search and an inactive flag
- **Hire** a nearby player: they get a job offer to accept or decline
- **A page per member**: hire date, last online, last on duty and hours for the last eight weeks
- **Change role** from a list of every role below the boss's own, **clock out** a member who forgot, or **fire**
- **Recent activity**: hires, departures, role changes and duty
- **Message** everyone on duty in the job
- **Boss menu button**: opens your framework's boss menu for money and society

### For staff and owners

- **Automatic sync with any boss menu**: hires, promotions and fires from any resource, also for players who are offline
- **Staff tools** in the hub: give and remove jobs with a player picker, plus `/givemultijob` and `/removemultijob`
- **Rules**: max jobs, extra slots by ACE or group (VIP), locked jobs, blocked jobs, and exclusive groups (police or a gang, not both)
- **Switch checks**: no switching while dead, cuffed or (optionally) in a vehicle, plus your own checks
- **Logs** to a Discord webhook and/or ox_lib's logger (Datadog, Loki, Fivemanage)
- **Developer API**: the v2 exports, new ones for duty, hours and rules, and events, with LuaLS types

### Servers

- **FiveM and RedM** in one resource
- **Frameworks**: Qbox (using its own multi-job storage), QBCore, ESX, ox_core, RSG-Core, VORP, or standalone, detected automatically
- **Job creators**: jobs from Jaksam's and Lunar's job creators are read automatically
- **Open where it matters**: config, framework bridges, translations and theme are outside escrow
- **14 languages**: English, German, Spanish, French, Portuguese (Brazil), Italian, Dutch, Polish, Swedish, Danish, Norwegian, Finnish, Czech and Turkish
- **No SQL to run**: tables are created on first start

## Requirements

- SQL resource: oxmysql, ghmattimysql, mysql-async
- Framework: QBCore, ESX
- **oxmysql**
- A framework is optional: Qbox, QBCore, ESX, ox_core (FiveM), RSG-Core, VORP (RedM), or none

Owners of v2: see [Upgrading from v2](/multijobs/upgrading).
Loading
Loading