From 2b0fc0de4ecf96f25c19377b0021da6ccc3dbf9d Mon Sep 17 00:00:00 2001 From: Z3rio Date: Mon, 30 Nov 2026 15:02:05 +0100 Subject: [PATCH 1/2] docs(multijobs): v3: installation, configuration, upgrading from v2, FAQ and API Rewrites the multijobs pages for v3: the job hub, automatic sync with any boss menu (no SetJob edits), Qbox's own job storage and its two convars, the LB-Phone app, 14 languages, and every export and event. Adds a configuration guide and a step-by-step upgrade from v2 with where each old setting went. --- pages/multijobs/_meta.ts | 8 +- pages/multijobs/configurationguide.mdx | 172 +++++++++++++++++++++++++ pages/multijobs/description.mdx | 55 ++++++-- pages/multijobs/devdocs.mdx | 135 +++++++++++++++---- pages/multijobs/faq.mdx | 145 ++++++++++----------- pages/multijobs/installationguide.mdx | 93 ++++++++++++- pages/multijobs/upgrading.mdx | 92 +++++++++++++ 7 files changed, 578 insertions(+), 122 deletions(-) create mode 100644 pages/multijobs/configurationguide.mdx create mode 100644 pages/multijobs/upgrading.mdx diff --git a/pages/multijobs/_meta.ts b/pages/multijobs/_meta.ts index 08042a2..0878c77 100644 --- a/pages/multijobs/_meta.ts +++ b/pages/multijobs/_meta.ts @@ -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" }; diff --git a/pages/multijobs/configurationguide.mdx b/pages/multijobs/configurationguide.mdx new file mode 100644 index 0000000..3b647dc --- /dev/null +++ b/pages/multijobs/configurationguide.mdx @@ -0,0 +1,172 @@ +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 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, ...) | + + + 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). + + +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 see the employees of their current job: role, duty and hours this week. They can change the role of anyone below their own role, or fire them. + +```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' +} +``` + +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. + +## 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 [grade] +/removemultijob +``` + +## 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/.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-`. diff --git a/pages/multijobs/description.mdx b/pages/multijobs/description.mdx index 16bb41b..7ede8ff 100644 --- a/pages/multijobs/description.mdx +++ b/pages/multijobs/description.mdx @@ -1,20 +1,49 @@ -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 `** switches straight away, with the player's jobs as choices in [Zerio Chat](/chat/description) +- **LB-Phone app** with the Jobs and Team pages -
+### For bosses -} - 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 +- **Change role** from a list of every role below the boss's own, or **fire** +- **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). diff --git a/pages/multijobs/devdocs.mdx b/pages/multijobs/devdocs.mdx index 583e1d0..a3d8024 100644 --- a/pages/multijobs/devdocs.mdx +++ b/pages/multijobs/devdocs.mdx @@ -1,67 +1,152 @@ # Developer Documentation -Information you as a developer, wanting to extend the resource might want to know will be listed here. +Exports, events and framework support, for developers extending zerio-multijobs or connecting other resources to it. LuaLS type definitions for everything below ship in `types/zerio-multijobs.lua`: add the folder to your workspace library for autocomplete. -Such as notable exports, or such. +`identifier` is always the **character** id: -If empty, then nothing notable exists at the moment. +| Framework | identifier | +| ---------------------- | ---------------- | +| Qbox, QBCore, RSG-Core | `citizenid` | +| ESX | `identifier` | +| ox_core | `charId` | +| VORP | `charidentifier` | -## Exports +## Server exports -### Server +### Jobs + +The v2 exports keep working as they did. + +#### AddJob + +```lua +local added = exports['zerio-multijobs']:AddJob(identifier, jobName, grade) +``` + +Adds a job, or changes its grade if the player already holds it. Returns `false` when it breaks a rule (job limit, exclusive group, blocked job); an online player is told why. + +#### RemoveJob + +```lua +local removed = exports['zerio-multijobs']:RemoveJob(identifier, jobName) +``` + +An online player working that job moves to the default job; an offline one at their next login. + +#### UpdateJobRank + +```lua +local changed = exports['zerio-multijobs']:UpdateJobRank(identifier, jobName, grade) +``` #### GetJobs ```lua -local jobs = exports["zerio-multijobs"]:GetJobs(identifier) +local jobs = exports['zerio-multijobs']:GetJobs(identifier) +-- { { name = 'police', rank = 2, jobName = 'police', jobGrade = 2 }, ... } ``` -This export takes in the players identifier as an parameter, and returns their current list of jobs. +#### CountJobs -#### AddJob +```lua +local count = exports['zerio-multijobs']:CountJobs(identifier) +``` + +#### DoesPlayerHaveJob ```lua -exports["zerio-multijobs"]:AddJob(identifier, jobname, jobgrade) +local hasJob = exports['zerio-multijobs']:DoesPlayerHaveJob(identifier, jobName) ``` -This export adds a job to the players multijob list. The grade should be as a number, not the name/label of the grade. +#### GetPlayersWithJob -#### RemoveJob +```lua +local players = exports['zerio-multijobs']:GetPlayersWithJob(jobName) +-- { { identifier = 'ABC12345', grade = 2, rank = 2 }, ... }, online or not +``` + +#### CanAddJob ```lua -exports["zerio-multijobs"]:RemoveJob(identifier, jobname) +local allowed, reason = exports['zerio-multijobs']:CanAddJob(identifier, jobName) +-- reason: 'max_jobs' or 'exclusive' when not allowed ``` -This export removes a job from a specific player +#### GetSlots -#### UpdateJobRank +```lua +local slots = exports['zerio-multijobs']:GetSlots(source) +-- { used = 2, max = 3 }; max is nil without a limit +``` + +### Switching and duty + +Results are `{ ok = true }` or `{ ok = false, error = '...' }`, where `error` is a text you can show the player. + +#### SwitchJob ```lua -exports["zerio-multijobs"]:UpdateJobRank(identifier, jobname, newjobgrade) +local result = exports['zerio-multijobs']:SwitchJob(source, jobName, force) ``` -This export can be used to upgrade the grade of a job that the player already has. +Makes a held job the active one. Skips the cooldown and the switch checks unless `force` is `false`. -#### CountJobs +#### SetDuty ```lua -local count = exports["zerio-multijobs"]:CountJobs(identifier) +local result = exports['zerio-multijobs']:SetDuty(source, onDuty) ``` -Returns how many jobs a player currently has +#### IsOnDuty -#### DoesPlayerHaveJob +```lua +local onDuty = exports['zerio-multijobs']:IsOnDuty(source) +``` + +On duty in a job other than the default one. On frameworks without duty (ox_core, VORP): working a job. + +#### GetOnlineCount ```lua -local hasJob = exports["zerio-multijobs"]:DoesPlayerHaveJob(identifier, jobname) +local count = exports['zerio-multijobs']:GetOnlineCount(jobName) +-- { online = 5, onDuty = 3 } ``` -This export can be used to check whether a player has a specific job, or not. +#### GetHours -#### GetPlayersWithJob +```lua +local hours = exports['zerio-multijobs']:GetHours(identifier) +-- { police = { week = 41260, total = 662400 }, ... } in seconds; the week starts on Monday +``` + +## Client exports ```lua -local players = exports["zerio-multijobs"]:GetPlayersWithJob(jobname) +exports['zerio-multijobs']:Open() +exports['zerio-multijobs']:Close() ``` -This export returns a list of all player identifiers with a specific job. Very useful in forexample bossmenus, or such. +Open the hub from your own resource, for example a radial menu or an ox_inventory item. + +## Events + +Server events, for `AddEventHandler`. `source` is `nil` when the player is offline. + +| Event | Arguments | When | +| ----------------------------- | -------------------------------- | ---------------------------------------------- | +| `zerio-multijobs:jobAdded` | `identifier, job, grade, source` | A job was added (a hire, staff, an export) | +| `zerio-multijobs:jobRemoved` | `identifier, job, source` | A job was removed (quit, fired, staff, a rule) | +| `zerio-multijobs:jobSwitched` | `source, job, from` | A player switched their active job | +| `zerio-multijobs:dutyChanged` | `source, job, onDuty` | A player went on or off duty | + +```lua +AddEventHandler('zerio-multijobs:jobSwitched', function(source, job, from) + print(('%s switched from %s to %s'):format(GetPlayerName(source), from, job)) +end) +``` + +## Frameworks + +Each framework is one file in `bridge/`, outside escrow, picked by `Config.bridge` (`'auto'` tries `Config.bridgeOrder`). `bridge/standalone.lua` documents every function a bridge can provide; a bridge only implements what differs, the rest falls back to standalone. + +To support another framework, copy the closest bridge (for example `bridge/qb.lua` for a QBCore fork), change the resource name and calls, add the file to `server_scripts` in `fxmanifest.lua` before `server/bridge.lua`, and add its name to `Config.bridgeOrder`. When the framework changes a player's job, call `MJ.jobChanged(source)`; on load and unload, `MJ.playerLoaded(source)` and `MJ.playerUnloaded(source)`. diff --git a/pages/multijobs/faq.mdx b/pages/multijobs/faq.mdx index 15ad900..8ce6427 100644 --- a/pages/multijobs/faq.mdx +++ b/pages/multijobs/faq.mdx @@ -1,81 +1,68 @@ -import { Tabs } from "nextra/components"; - # Frequently asked questions -A list of frequently asked questions can be seen below. - -If this is empty and you have a question, please turn to the support in our [community server](https://discord.zerio-scripts.com) instead! - -## How do I give jobs to players? - -By default, the commands `/givemultijob` and `/removemultijob` exist. Continue reading here if you wish to integrate with the `SetJob` function, allowing all other commands and such to automatically add the job as a multijob too. - -## SetJob integration - - - - Open the `es_extended/server/classes/player.lua` file. Then find the `setJob` function. - - Then, you'll want to add the following snippet at the end of this function. - - ```lua - local jobs = exports["zerio-multijobs"]:GetJobs(self.identifier) - local notFound = true - for _,v in pairs(jobs) do - if v.name == self.job.name then - notFound = false - end - end - if notFound then - exports["zerio-multijobs"]:AddJob(self.identifier, self.job.name, self.job.grade) - else - exports["zerio-multijobs"]:UpdateJobRank(self.identifier, self.job.name, self.job.grade) - end - ``` - - - - - Open the `qb-core/server/player.lua` file. Then find the `SetJob` function. - - You'll want to add the following snippet **above** the `return true` line. - - ```lua - local jobs = exports["zerio-multijobs"]:GetJobs(self.PlayerData.citizenid) - local notFound = true - for _,v in pairs(jobs) do - if v.name == job then - notFound = false - end - end - if notFound then - exports["zerio-multijobs"]:AddJob(self.PlayerData.citizenid, job, tonumber(grade)) - else - exports["zerio-multijobs"]:UpdateJobRank(self.PlayerData.citizenid, job, tonumber(grade)) - end - ``` - - - - - Open the `qbx_core/server/player.lua` file. Then find the `SetPlayerPrimaryJob` function. - - You'll want to add the following snippet **above** the `return true` line. - - ```lua - local jobs = exports["zerio-multijobs"]:GetJobs(citizenid) - local notFound = true - for _,v in pairs(jobs) do - if v.name == jobName then - notFound = false - end - end - if notFound then - exports["zerio-multijobs"]:AddJob(citizenid, jobName, tonumber(grade)) - else - exports["zerio-multijobs"]:UpdateJobRank(citizenid, jobName, tonumber(grade)) - end - ``` - - - +If your question is not here, ask in our [community server](https://discord.zerio-scripts.com). + +## How do players get jobs? + +The way they already do on your server. When a boss menu, a job center or a staff command sets a player's job, zerio-multijobs adds it to their list by itself, also when the player was offline. Staff can also give jobs from Staff tools in the hub, or with `/givemultijob [grade]`. + +You do not need to edit your framework. v2 asked for a `SetJob` edit; v3 does not, see [Upgrading from v2](/multijobs/upgrading). + +## How are fires and promotions picked up? + +On Qbox, jobs live in qbx_core's own multi-job list, so every change there shows up at once. On the other frameworks, zerio-multijobs compares the framework's job with the last one it saw, on every job change and at every login: + +| What happened | Seen as | +| ------------------------------------------ | --------------------------------- | +| Moved to a job not in the list | Hired: the job is added | +| Moved from a listed job to the default job | Fired: the job is removed | +| Same job, new grade | Promoted or demoted | +| Removed from the list while offline | Moved to the default job at login | + +## The hub says "1 of 1 jobs" on Qbox + +qbx_core's own limit is 1. Add `setr qbx:max_jobs_per_player 3` (or your `Config.maxJobs` plus extra slots) to `server.cfg` and **restart the whole server**: qbx_core reads it only when it starts. See the [Installation Guide](/multijobs/installationguide). + +## Hiring someone on Qbox replaced their other job + +Set `setr qbx:setjob_replaces false` in `server.cfg` and restart the server. With `true`, qbx_core removes the player's previous job whenever a resource calls `SetJob`. + +## A player lost a job after being hired + +A hire from a boss menu always goes through: the new job is kept, and the oldest job that breaks a rule (the job limit or an exclusive group) is removed. The player is told which. Locked jobs are never removed this way. + +## Can I give VIPs more job slots? + +Yes, with `Config.extraSlots` in `config/general.lua`, by ACE or framework group: + +```lua +Config.extraSlots = { + ['zeriomultijobs.vip'] = 2, +} +``` + +On Qbox, raise `qbx:max_jobs_per_player` to match. + +## Can players quit the police job? + +Not if it is locked: `locked = true` in `config/jobs.lua`. Bosses and staff can still remove it. + +## Who sees the Team page? + +Grades your framework marks as boss, plus the minimum grade per job you set in `Config.boss.minGrade`. They can change the role of anyone below their own role, or fire them. Money and society stay in your boss menu; set `Config.boss.menuEvent` for a button that opens it. + +## Does pay change? + +No. Your framework pays the active job, as it always has. Switching jobs changes which job is paid. + +## The LB-Phone app does not show up + +It is added when lb-phone runs, so start zerio-multijobs **after** lb-phone. Check that `Config.lbPhone.enabled` is `true`. With `defaultApp = false`, players install it from the App Store. + +## Jobs from Jaksam's or Lunar's job creator have no name + +They are read automatically while the job creator is running; there is nothing to turn on. Make sure the job creator starts before zerio-multijobs. + +## How do I change texts or add a language? + +Edit `locales/.json`, or copy `locales/en.json` for a new language. See [Languages](/multijobs/configurationguide#languages). diff --git a/pages/multijobs/installationguide.mdx b/pages/multijobs/installationguide.mdx index 7f9e2f7..856ca66 100644 --- a/pages/multijobs/installationguide.mdx +++ b/pages/multijobs/installationguide.mdx @@ -1,5 +1,94 @@ +import { Callout, Steps } from "nextra/components"; + # Installation Guide -Installing this resource is as easy as simply dragging and dropping it into your resources folder. Then you'll ofcourse want to execute the sql file. +This guide installs zerio-multijobs on a FiveM or RedM server. Upgrading from v2? Follow [Upgrading from v2](/multijobs/upgrading) instead. + +## Prerequisites + +- **oxmysql**, started before zerio-multijobs. +- **A framework is optional.** Qbox, QBCore, ESX and ox_core (FiveM) and RSG-Core and VORP (RedM) are detected automatically. Without one, zerio-multijobs runs standalone and keeps the job in the player's `job` state bag. + +## Installation Steps + + + +### Download and place the resource + +Download zerio-multijobs from the [Cfx portal](https://portal.cfx.re) (see [After Buying](/afterbuying)) and put the `zerio-multijobs` folder in your resources: + +``` +resources/ + └── [zerio]/ + └── zerio-multijobs/ +``` + + + Keep the folder name `zerio-multijobs`: other resources call its exports by + that name. + + +### Start it in server.cfg + +Start it **after** oxmysql and your framework (and after lb-phone, if you use the phone app): + +```cfg +ensure oxmysql +ensure qbx_core # or qb-core, es_extended, ox_core, rsg-core, vorp_core +ensure zerio-multijobs +``` + +The tables are created on the first start. There is no SQL to run. + +### Qbox only: let qbx_core hold several jobs + +On Qbox, zerio-multijobs uses qbx_core's own multi-job storage, so qbx_core's limits apply. Add these lines to `server.cfg`: + +```cfg +setr qbx:max_jobs_per_player 3 # at least Config.maxJobs plus any extra slots +setr qbx:setjob_replaces false # a hire through SetJob keeps the player's other jobs +``` + + + qbx_core reads these once, when it starts: **restart the whole server** after + changing them. If the limit is lower than `Config.maxJobs`, the hub shows the + lower one and the console warns at start. + + +### Give staff access + +Staff tools (giving and removing jobs) need the ACE `zeriomultijobs.admin` **or** your framework's `admin` group (QBCore and Qbox permission, ESX group, ...): + +```cfg +add_ace group.admin zeriomultijobs.admin allow +``` + +Both are set in `Config.admin` in `config/general.lua`. + +### Pick a language + +Set `Config.locale` in `config/general.lua`. Available: `en`, `de`, `es`, `fr`, `pt` (Brazil), `it`, `nl`, `pl`, `sv`, `da`, `no`, `fi`, `cs`, `tr`. + +### Start the server + +Start (or restart) the server. The console shows which framework was found: + +``` +[zerio-multijobs] using bridge: qbx +``` + +In game, press **F4** or type `/jobs` to open the hub. + + + +## LB-Phone + +With lb-phone running, a **Jobs** app is added to every phone: the Jobs and Team pages, following the phone's light or dark mode. Turn it off, or sell it in the App Store instead, with `Config.lbPhone` in `config/general.lua`. + +## RedM + +The same resource runs on RedM with RSG-Core or VORP. There is no key to open the hub (use `/jobs` or an item), no LB-Phone app, and VORP has no duty: hours count while a job is the active one. + +## Updating -We do recommend you follow the \"setjob integration\" documented [here](/multijobs/faq#setjob-integration). If not, you'll have to manually add zerio-multijob\'s exports to places where players should get a multijob, such as being hired, etc. +Read the changelog in the download, then replace the folder, keeping your `config` folder and any changes you made to `bridge`, `locales` or `theme`. When an update adds files, run `refresh` before `ensure zerio-multijobs` (or restart the server). diff --git a/pages/multijobs/upgrading.mdx b/pages/multijobs/upgrading.mdx new file mode 100644 index 0000000..3ae22b4 --- /dev/null +++ b/pages/multijobs/upgrading.mdx @@ -0,0 +1,92 @@ +import { Callout, Steps } from "nextra/components"; + +# Upgrading from v2 + +v3 is a free update for everyone who owns zerio-multijobs. Your players keep their jobs, and the v2 exports and commands keep working. What changes for you as the owner is the config, the requirements, and the `SetJob` edits v2 asked you to make, which v3 no longer needs. + +Plan about 15 minutes, and take a database backup first. + + + +### Back up the old resource and your database + +Keep a copy of your v2 `zerio-multijobs` folder (you need its `config.lua` below), and back up the database. + +### Remove the SetJob edits + +v2's FAQ had you paste a snippet into `es_extended`, `qb-core` or `qbx_core` so hires reached the multi-job list. v3 follows job changes by itself, also for players who were offline, so **remove that snippet** from: + +- ESX: `es_extended/server/classes/player.lua`, function `setJob` +- QBCore: `qb-core/server/player.lua`, function `SetJob` +- Qbox: `qbx_core/server/player.lua`, function `SetPlayerPrimaryJob` + +Leaving it in does no harm on QBCore and ESX, but there is no reason to keep a patch in your framework. + +### Make sure oxmysql runs + +v3 needs **oxmysql**. mysql-async and ghmattimysql are no longer supported. Start `oxmysql` before your framework and zerio-multijobs. + +### Replace the folder + +Delete the old `zerio-multijobs` folder and put the v3 one in its place. Keep the name `zerio-multijobs`: other resources call its exports by that name. + +### Move your settings + +`config.lua` is now three files in `config/`. Copy your values over using the table below. + +### Qbox only: two server.cfg lines + +On Qbox, v3 stores jobs in qbx_core's own multi-job list, so qbx_core's limits apply. Add these to `server.cfg`, then **restart the whole server** (qbx_core reads them once, at start): + +```cfg +setr qbx:max_jobs_per_player 3 # at least Config.maxJobs plus any extra slots +setr qbx:setjob_replaces false # a hire through SetJob keeps the player's other jobs +``` + +On the first start, v3 moves your v2 rows into qbx_core and keeps the old table as `zerio_multijobs_v2`. + +### Start and check + +Start the server. The console shows which framework v3 found, and warns about anything it needs: + +``` +[zerio-multijobs] using bridge: qbx +``` + + + +## Where each v2 setting went + +| v2 (`config.lua`) | v3 | +| ------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `Config.Locale` | `Config.locale` in `config/general.lua` | +| `Config.OpenType`, `CommandName`, `Keybind`, `Item` | `Config.open = { command, key, item }`: any of them at once, `false` turns one off | +| `Config.Currency` | `Config.currency` | +| `Config.UsingJaksamJobCreator`, `UsingLunarJobsCreator` | Gone: both job creators are found automatically | +| `Config.EnableESXIdentity` | Gone: names come from ESX, with esx_identity when it runs | +| `Config.DefaultJob`, `Config.DefaultGrade` | `Config.defaultJob` (leave `nil` for the framework's own) | +| `Config.IncludeDefaultJobInMenu` | `Config.showDefaultJob` | +| `Config.MaxJobs` | `Config.maxJobs` (`false` for no limit) | +| `Config.JobIcons` | `icon` per job in `Config.jobs`, `config/jobs.lua` | +| `Config.DefaultIcon` | `Config.defaultIcon` | +| `Config.BlockedJobs` | `blocked = true` per job in `Config.jobs` | +| `Config.LockedJobs` | `locked = true` per job in `Config.jobs` | +| `html/theme.css` | `theme/tokens.css` | + + + **Two defaults changed.** v2 allowed unlimited jobs (`Config.MaxJobs = -1`); + v3 allows **3** (`Config.maxJobs = 3`). And v2 opened with **F4** only; v3 + opens with F4 **and** `/jobs`. Set them back if you prefer the old behaviour. + + +Icons: v2 used Material Design names (`mdi-account-star`). v3 has its own set, or an image URL per job, see the [Configuration Guide](/multijobs/configurationguide#jobs). + +## Translations + +v3's texts are in `locales/*.json`, in 14 languages. If you translated v2 yourself (`locales/.lua`), that file does not carry over: the texts changed. Start from `locales/en.json` or the closest included language, see [Languages](/multijobs/configurationguide#languages). + +## What stays the same + +- The `zerio_multijobs` table and your players' jobs (on Qbox they move into qbx_core, see above). +- `/givemultijob` and `/removemultijob`. +- Every v2 export: `AddJob`, `RemoveJob`, `UpdateJobRank`, `GetJobs`, `CountJobs`, `DoesPlayerHaveJob`, `GetPlayersWithJob`, and the client export `Open`. See the [Developer Documentation](/multijobs/devdocs). From 98a1450078391d92ef9a637169d533ec9bed73e9 Mon Sep 17 00:00:00 2001 From: Z3rio Date: Mon, 30 Nov 2026 15:19:42 +0100 Subject: [PATCH 2/2] docs(multijobs): Team page: hiring, member pages, activity, clock out, messages --- pages/multijobs/configurationguide.mdx | 23 ++++++++++++++++++++++- pages/multijobs/description.mdx | 8 ++++++-- pages/multijobs/faq.mdx | 10 +++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/pages/multijobs/configurationguide.mdx b/pages/multijobs/configurationguide.mdx index 3b647dc..06faa57 100644 --- a/pages/multijobs/configurationguide.mdx +++ b/pages/multijobs/configurationguide.mdx @@ -89,18 +89,39 @@ Hours are counted per job while on duty, saved every five minutes and when a pla ## Team page -Bosses see the employees of their current job: role, duty and hours this week. They can change the role of anyone below their own role, or fire them. +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 diff --git a/pages/multijobs/description.mdx b/pages/multijobs/description.mdx index 7ede8ff..213189f 100644 --- a/pages/multijobs/description.mdx +++ b/pages/multijobs/description.mdx @@ -19,8 +19,12 @@ It looks like the rest of Zerio's scripts: a frosted-glass panel over the game, ### For bosses -- **Team page**: every employee of the current job, online or not, with role, duty and hours this week -- **Change role** from a list of every role below the boss's own, or **fire** +- **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 diff --git a/pages/multijobs/faq.mdx b/pages/multijobs/faq.mdx index 8ce6427..f77b123 100644 --- a/pages/multijobs/faq.mdx +++ b/pages/multijobs/faq.mdx @@ -49,7 +49,15 @@ Not if it is locked: `locked = true` in `config/jobs.lua`. Bosses and staff can ## Who sees the Team page? -Grades your framework marks as boss, plus the minimum grade per job you set in `Config.boss.minGrade`. They can change the role of anyone below their own role, or fire them. Money and society stay in your boss menu; set `Config.boss.menuEvent` for a button that opens it. +Grades your framework marks as boss, plus the minimum grade per job you set in `Config.boss.minGrade`. They can hire, change the role of anyone below their own role, clock members out, fire them, and message everyone on duty. Money and society stay in your boss menu; set `Config.boss.menuEvent` for a button that opens it. + +## Can bosses hire from the Team page? + +Yes. **Hire** lists the players within `Config.boss.hire.range` metres (or everyone online with `range = false`). The boss picks a role below their own, and the player gets a job offer in their hub (and a notification) to accept or decline within `offerSeconds`. + +## Why is a member marked Inactive? + +They have not been online for `Config.boss.inactiveDays` days (14 by default). Set it to `false` to turn the mark off. ## Does pay change?