Page cover

๐Ÿ•น๏ธSpectro_MultiJobs

๐Ÿ“˜ Spectro MultiJobs - Complete Documentation

Advanced multi-job management system for FiveM with admin panel, customizable interface, and multi-framework compatibility

๐Ÿ“‹ Table of Contents

๐ŸŒŸ Key Features

โœจ For Players

  • Multiple Simultaneous Jobs: Maintain several regular jobs and extras

  • Instant Switching: Toggle between jobs with a single click

  • Modern Interface: Intuitive and responsive design

  • Rank Preservation: Each job maintains its own rank

  • Extra Jobs: Additional jobs managed by administrators

  • Configurable Cooldown: Integrated system to prevent abuse

๐Ÿ› ๏ธ For Administrators

  • Complete Panel: Total control over jobs and ranks

  • Player Management: Assign or modify jobs for any player

  • Real-Time Editing: No need to restart the server

  • Total Customization: Configure every aspect of the system

  • Boss System: Department heads can manage employees

  • Granular Permission Control: Define specific access by group

๐Ÿ”ง Technical Features

  • Multi-Framework: Compatibility with ESX and QBCore

  • Automatic Detection: Identifies and adapts to the server framework

  • Optimized Database: Efficient structure in MySQL

  • Low Resource Consumption: Optimized for busy servers

  • Adaptable Interface: Works at any resolution

  • Visual Customization: Fully adjustable theme and colors

๐Ÿ“‹ Requirements and Dependencies

๐Ÿšจ Mandatory Dependencies

  • MySQL: Compatible with mysql-async, oxmysql, ghmattimysql

  • Framework: ESX or QBCore (automatic detection)

๐Ÿ“Š Server Requirements

  • FiveM Version: Artifact 5181 or higher

  • RAM Memory: Minimum 4GB

  • Disk Space: 2MB

๐Ÿ”— Compatible Frameworks

  • ESX: All versions (including ESX Legacy)

  • QBCore: All versions

  • ESX Infinity/Legacy: Fully compatible

โœ… Compatibility Guarantee: This script works perfectly with any version of ESX and QBCore without the need for additional adjustments.

๐Ÿ”ง Step-by-Step Installation

Step 1: Preparation

  • Download the script files

  • Extract the content to a temporary directory

  • IMPORTANT: Rename the main folder to Spectro_multijobs

Step 2: Database

-- Execute this command in your MySQL manager (phpMyAdmin, HeidiSQL, etc.)
CREATE TABLE IF NOT EXISTS `player_multijobs` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `identifier` varchar(60) NOT NULL,
    `job` varchar(50) NOT NULL,
    `job_grade` int(11) NOT NULL DEFAULT 0,
    `is_active` tinyint(1) NOT NULL DEFAULT 0,
    `is_default` tinyint(1) NOT NULL DEFAULT 0,
    `job_index` int(11) NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`),
    KEY `identifier` (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Step 3: server.cfg Configuration

# Make sure you have a database system installed
ensure mysql-async  # Or your preferred system (oxmysql, ghmattimysql, etc.)

# Make sure your framework is properly loaded
ensure es_extended  # Or qb-core

# Finally, load the script
ensure Spectro_multijobs

Step 4: Initial Configuration

  • Open config.lua

  • Adjust the administration groups:

Config.AdminGroups = {'admin', 'superadmin'}  -- Add your admin groups
  • Configure the maximum number of jobs:

Config.MaxJobs = 2  -- Maximum number of regular jobs
  • Set the cooldown between changes:

Config.JobCooldown = 10  -- Seconds of waiting between changes

Step 5: Restart the Server

# In the server console
refresh
restart Spectro_multijobs

โš™๏ธ General Configuration

๐ŸŽจ Basic Configuration

Config.Locale = 'es'                     -- Language (currently only 'es' available)
Config.MaxJobs = 2                       -- Maximum number of regular jobs
Config.Command = 'trabajos'              -- Command to open the menu
Config.AdminGroups = {'admin'}           -- Groups that can assign jobs
Config.JobCooldown = 10                  -- Waiting time between changes (seconds)
Config.ThemeColor = '#DFF900'            -- Theme color (HEX)

๐Ÿšซ Framework Configuration

Config.Framework = 'auto'                -- 'auto', 'esx', 'qbcore'
Config.UseOldESXEvent = false            -- For older ESX versions

-- QBCore specific configuration
Config.QBCoreName = 'qb-core'            -- QBCore resource name
Config.QBCoreDefaultJob = 'unemployed'   -- Default job
Config.QBCoreDefaultGrade = 0            -- Default grade

๐ŸŽญ Permission Configuration

Config.BossCanManageEmployees = true     -- If bosses can manage employees
Config.MinGradesForBoss = 3              -- Minimum grades to be considered a boss
Config.NonAdminJobs = {}                 -- Jobs that don't require admin permissions

๐Ÿงฐ Development Configuration

Config.EnableLogs = false                -- Enable debugging logs
Config.DebugMode = false                 -- Advanced debug mode
Config.EnableUILogs = false              -- UI logs

๐Ÿ‘ค Job System

๐Ÿ“‹ Job Types

  1. Regular Jobs:

    • Limited by Config.MaxJobs (usually 2-3)

    • Database indices 0-2

    • Manageable by the player

  2. Extra Jobs:

    • No predefined limit

    • Database indices 3+

    • Only administrators can modify them

๐Ÿ”„ Job Switching

  • Only one active job at a time

  • Instant change with automatic synchronization

  • Configurable cooldown to prevent abuse

  • Immediate update of ranks and permissions

โœจ Default Jobs

Config.DefaultJobs = {'unemployed', 'unemployed'}
  • Automatically assigned to new players

  • Used when resetting jobs

  • Flexible configuration by position

๐Ÿ›ก๏ธ Admin Panel

๐ŸŽฏ Main Features

  1. Player Management:

    • View all jobs for each player

    • Add/modify/delete jobs

    • Reset jobs to default values

  2. Job Assignment:

    • Any job available on the server

    • Specific rank selection

    • Assignment as regular or extra job

  3. System Configuration:

    • Cooldown settings, maximum jobs

    • Administration groups

    • Default jobs

    • Visual customization

๐Ÿ”‘ Panel Access

  • Only for members of groups defined in Config.AdminGroups

  • Automatic permission verification when opening the menu

  • Real-time updates when changing permissions

๐Ÿ” Permission System

๐Ÿ‘ฎ Boss System

A player is considered a "boss" if they meet these conditions:

  1. They have the highest rank in their job

  2. The job has at least Config.MinGradesForBoss ranks (default 3)

  3. The option Config.BossCanManageEmployees is activated

Bosses can:

  • View all employees in their department

  • Promote employees to ranks lower than their own

  • Fire employees

๐Ÿ‘ฅ Administration

Members of Config.AdminGroups can:

  • Access the complete administration panel

  • Manage all jobs for any player

  • Add unlimited extra jobs

  • Configure all aspects of the system

๐Ÿ–ฅ๏ธ User Interface

๐Ÿ“ฑ Main Tabs

  1. My Jobs:

    • Lists all your available jobs

    • Shows active job, ranks, and salaries

    • Buttons to activate or reset jobs

  2. Manage Employees (bosses only):

    • List of department employees

    • Online/offline status of each employee

    • Options to change ranks

    • Option to fire employees

  3. Manage Jobs (admins only):

    • Job assignment to players

    • Complete job management by player

    • System configuration

๐ŸŽจ Visual Customization

  • Customizable theme color

  • Adjustable menu position

  • Fully translatable texts

โ“ Frequently Asked Questions

๐Ÿ“Œ Installation and Configuration

How do I open the jobs menu?

  • Use the /trabajos command (or the one configured in Config.Command)

  • Make sure you have the appropriate permissions

  • Verify that the script is correctly installed

Is the script compatible with my ESX/QBCore version?

  • Yes, it's compatible with all versions of ESX and QBCore

  • The system automatically detects the framework

  • No additional configuration required to work

Can I change the maximum number of jobs?

  • Yes, modify Config.MaxJobs in config.lua

  • Only affects regular jobs

  • Extra jobs have no predefined limit

How do I add administrators?

  • Add the groups in Config.AdminGroups = {'admin', 'superadmin', 'moderator'}

  • Make sure players have these groups in your framework

  • Restart the script after modifying the configuration

๐Ÿ“Œ Features and Usage

Are jobs saved when restarting the server?

  • Yes, all jobs are stored in the database

  • They persist between restarts and reconnections

  • Include jobs, ranks, and states

How do extra jobs work?

  • Extra jobs are assigned by administrators

  • They don't count towards the regular job limit

  • They can only be modified by administrators

  • They have index 3 or higher in the database

Can players delete their own jobs?

  • They can reset regular jobs to default values

  • They cannot delete extra jobs

  • Administrators can delete any job

How does the boss system work?

  • A player with the highest rank in a job is considered a boss

  • The job must have at least Config.MinGradesForBoss ranks

  • Bosses can manage employees from the main menu

  • They can promote/fire employees in their department

๐Ÿ“Œ Customization and Advanced

Can I change the visual appearance of the menu?

  • Yes, through Config.ThemeColor to change the main color

  • Customize the menu position

  • Modify texts through the localization system

Does the system work with custom jobs?

  • Yes, compatible with any job configured in your framework

  • Automatically detects jobs and ranks

  • Works with custom or modified jobs

Can I limit which jobs administrators can assign?

  • Yes, configure Config.NonAdminJobs with allowed jobs

  • Set specific permissions by group

  • Differentiate between regular and extra jobs

Can it be used on servers with many players?

  • Yes, the system is optimized for large servers

  • Low resource consumption

  • Efficient data caching

โš ๏ธ Common Troubleshooting

๐Ÿ›‘ The Menu Doesn't Open

Problem
Possible Cause
Solution

The command doesn't work

The command is misconfigured

Check Config.Command in config.lua

Conflict with another script

Change the command in config.lua

Nothing appears when using the command

Incorrect resource name

Rename the folder to exactly Spectro_multijobs

NUI not loading

Verify that html, css, and js files exist

Console error

JavaScript error

Check the F8 console for specific errors

Resources loaded in incorrect order

Make sure to load your framework first

๐Ÿ”ด Database Errors

Problem
Possible Cause
Solution

"MySQL not found" error

Database system not loaded

Make sure to load mysql-async or another system

Database connection error

Incorrect credentials

Check connection settings

"player_multijobs not found" error

Table not created

Execute the SQL in the installation section

"identifier not found" error

Incompatible identifier

Check Config.ColumnMapping

๐ŸŸ  Framework Problems

Problem
Possible Cause
Solution

"ESX not found" error

ESX not loaded correctly

Make sure to load es_extended first

Old ESX version

Activate Config.UseOldESXEvent = true

"QBCore not found" error

QBCore not loaded

Verify that qb-core is loaded

Custom QBCore name

Configure Config.QBCoreName

Jobs don't update

Framework event not detected

Activate debug mode to identify the problem

๐ŸŸก Permission Problems

Problem
Possible Cause
Solution

Admin tab not showing

You're not in an admin group

Add your group to Config.AdminGroups

Permission detection problem

Verify your player's group in the framework

Boss tab not showing

You don't have the highest rank

Make sure you have the highest rank

Insufficient ranks in the job

The job needs Config.MinGradesForBoss ranks

Bosses can't manage employees

Option disabled

Activate Config.BossCanManageEmployees = true

๐Ÿ”ต Specific Code Errors

Error Code
Cause
Solution

attempt to index a nil value (field 'Config')

config.lua not loaded

Verify it's included in fxmanifest.lua

attempt to index a nil value (field 'JobGrades')

Job data not loaded

Wait for the server to fully load

table index is nil

Access to non-existent data

Activate debug mode to identify

ESX.RegisterServerCallback is not a function

Framework not initialized

Make sure the framework is fully loaded

๐ŸŸค Performance Issues

Problem
Possible Cause
Solution

Lag when opening the menu

Many jobs/ranks

Optimize the number of jobs/ranks

High CPU usage

Too many players changing jobs

Increase Config.JobCooldown

Slow response times

Slow database queries

Optimize database indices

Momentary freezes

Synchronous operations

Reduce logs and debug if activated

๐Ÿš€ Advanced Configuration

๐Ÿ“Š Advanced Database Settings

-- Customization of tables and columns
Config.DatabaseTables = {
    users = 'users',          -- Users table (ESX: users, QBCore: players)
    jobs = 'jobs',           -- Jobs table
    jobGrades = 'job_grades'  -- Ranks table
}

-- Column mapping between frameworks
Config.ColumnMapping = {
    identifier = {
        esx = 'identifier',   -- Identifier column in ESX
        qbcore = 'citizenid'  -- Identifier column in QBCore
    }
}

๐Ÿ›ก๏ธ Advanced Permission Configuration

-- Boss configuration
Config.BossCanManageEmployees = true    -- If bosses can manage employees
Config.MinGradesForBoss = 3             -- Minimum ranks to be considered a boss

-- Jobs that don't require administrator permissions
Config.NonAdminJobs = {
    "police",                 -- Allow assigning police job
    "ambulance",              -- Allow assigning medic job
    "mechanic"                -- Allow assigning mechanic job
}

๐Ÿ”ง Debugging Settings

-- Complete debugging enablement
Config.EnableLogs = true      -- Show logs in the server console
Config.DebugMode = true       -- Activate detailed debug mode
Config.EnableUILogs = true    -- Show NUI logs in the client console

-- Shows detailed information about:
-- - Framework detection
-- - Loading jobs and ranks
-- - Job assignment
-- - Job changes
-- - Specific errors

๐Ÿ“ž Support and Contact

โš ๏ธ Before Requesting Support

  1. Verify that you have followed the installation instructions exactly

  2. Check the troubleshooting section

  3. Activate debug mode to identify specific errors:

    Config.EnableLogs = trueConfig.DebugMode = trueConfig.EnableUILogs = true
  4. Restart the script after any configuration changes

๐Ÿ“‹ Information to Provide

When requesting support, always include:

  • Exact script version

  • Framework used (ESX or QBCore) and its version

  • Server logs with debug mode activated

  • Detailed description of the problem

  • Steps to reproduce the error

๐Ÿ› ๏ธ Diagnostic Tools

-- Activate debug mode in config.lua:
Config.DebugMode = true

-- Verify the database:
SHOW TABLES LIKE 'player_multijobs';
SELECT * FROM player_multijobs LIMIT 10;

-- Check resource loading:
ensure mysql-async  # Or your database system
ensure es_extended  # Or qb-core
ensure Spectro_multijobs

Documentation updated for Spectro_multijobs v1.0.1 Last update: 2025

Last updated