💼Ns-MultiJob

Let players have multiple jobs

-----INSTALLATION-----

STEP 1 - Unzip and Add Script To Server

Unzip the script folder within your server resources folder. Ensure script in server.cfg ... "ensure ns-multijob". ( NOTE : Please don't change the script name or folder name.)

STEP 2 - Script Configuration

When you open the config file you'll see a lines of codes to configure it to your server.

STEP 2.1 - Dependency Configuration

QBCore = exports['qb-core']:GetCoreObject() -- DO NOT REMOVE, MAY EDIT IF YOU KNOW WHAT YOUR DOING

Only dependancy is a QBCore server. If you changed the name of your framework folder, replace "qb-core" to your framework folder name.

STEP 2.2 - Job Icons

Config.Icons = { -- ICONS PRESENTED NEXT TO EACH JOB TYPES (optional)
    ['police'] = 'bi bi-shield-shaded',
    ['ambulance'] = 'fas fa-ambulance',
    ['tow'] = 'bi bi-truck-flatbed',
    ['taxi'] = 'fas fa-taxi',
    ['lawyer'] = 'bi bi-briefcase',
    ['judge'] = 'fas fa-gavel',
    ['realestate'] = 'bi bi-house',
    ['cardealer'] = 'fas fa-car',
    ['mechanic'] = 'bi bi-tools',
    ['reporter'] = 'bi bi-newspaper',
    ['trucker'] = 'fas fa-truck-moving',
    ['garbage'] = 'fas fa-recycle',
}

You can add icons you want to be displayed within the job menu, next to each specific job. This is optional and not required.

STEP 2.3 - Blacklisted Jobs

Config.BlackListedJobs = { -- JOBS THAT DO NOT GET ADDED TO MENU (leave blank if not needed)
    'taxi',
    'tow'
}

Jobs which you wish not to be added in the multi-job menu can be listed here. You can leave the table empty. This is an optional feature.

STEP 2.4 - Consumable Configuration

Config.AntiClockingSystem = { -- JOBS WHICH ARE NOT PERMITTED TO CLOCKIN/ CLOCKOUT USING MENU (leave blank if not needed)
    'police',
    'ambulance'
}

Jobs which you wish not to be allowed to use the clockin/ clockout system in the multi-job menu can be listed here. You can leave the table empty. This is an optional feature.

STEP 2.5 - Adding your notification system

function Notify(text, texttype, source) -- REPLACE WITH YOUR OWN NOTIFICATION SYSTEM (if needed)
    --[[ BASIC QBCORE USES SUCCESS AND ERROR, WHICH IS ALSO USED HERE. IF YOUR TEXT TYPES DIFFER, SIMPLY REPLACE SUCCESS AND ERROR WITH YOUR OWN TYPE
    if texttype == 'success' then
        texttype = -- add your success type here 
    else
        texttype = -- add your error type here 
    end]]
    if source == nil then
        QBCore.Functions.Notify(text, texttype, 6000) -- Client ide
    else
        QBCore.Functions.Notify(source, text, texttype, 6000) -- Server Side
    end
end

If you use any other notification system, edit it here.

STEP 3 - Run the SQL file

CREATE TABLE `player_jobs` (
    `cid` varchar(100) NOT NULL,
    `job` varchar(100) NOT NULL,
    `grade` int(11) NOT NULL
);

Last updated