Configuration

Available configuration options to customize the script.

let Config = {};

Config.Framework = 'auto'; // auto, qbox, qb, esx, custom
Config.Phone = 'auto' // auto, npwd_qbx_mail, qb-phone, lb-phone, gksphone, yseries, jpr-phonesystem, roadphone, custom
Config.Inventory = 'auto' // auto, ox_inventory, qb-inventory, qs-inventory, core_inventory, tgiann-inventory, ps-inventory, custom
Config.Jail = 'auto' // auto, xt-prison, custom

Config.Command = 'doj'; // Command for opening the main UI
Config.Keybind = { // Keymap for opening the UI
    enabled: true,
    key: 'j' // Default key. Can be changed by each player
};

Config.Menus = { // Menu locations
    citizen: {
        coords: [-545.41, -203.76, 37.22], // Coordinates, seperated by a comma
        radius: 2, // The radius from which the menu is accessible
        keybind: 38, // The control ID which should open the menu: https://docs.fivem.net/docs/game-references/controls/#controls,
        ped: {
            enabled: true,
            model: 'a_m_y_business_03',
            heading: 215.0
        }
    },
    lawyer: {
        coords: [-516.57, -210.99, 37.17],
        radius: 2,
        keybind: 38,
        ped: {
            enabled: true,
            model: 'cs_solomon',
            heading: 118.24
        }
    },
};

Config.Job = { // DOJ Job options. Everything here should match your framework job configuration
    name: 'doj',
    grades: [ // All grade levels, starting from 0
        {
            role: 'lawyer',
            isChiefJudge: false // Whether the grade has access to the 'requests' menu and can edit every case. Also has access to framework-specific features like bossmenu.
        },
        {
            role: 'prosecutor',
            isChiefJudge: false // Whether the grade has access to the 'requests' menu and can edit every case. Also has access to framework-specific features like bossmenu.
        },
        {
            role: 'judge',
            isChiefJudge: false // Whether the grade has access to the 'requests' menu and can edit every case. Also has access to framework-specific features like bossmenu.
        },
        {
            role: 'judge',
            isChiefJudge: true // Whether the grade has access to the 'requests' menu and can edit every case. Also has access to framework-specific features like bossmenu.
        },
    ],
}

Config.Fees = {
    fileCase: 100, // Set to 0 to remove fee
    losingParty: 500 // If a criminal case - the prosecutor or convicted. If a civilian case - the losing party.
}

// These are triggered immediately after the case is closed:
Config.AutoFine = true // Automatically fine the defendant of a criminal case if convicted (found guilty).
Config.AutoJail = true // Automatically send the player to jail if found guilty.
Config.AutoTransfer = true // Automatically transfer the settle amount of a civilian case from the losing party to the winning party.

Config.Evidence = {
    slots: 50,
    weight: 100000,
}

// #################################
//                                 #
//         PHONE INTEGRATION       # 
//                                 # 
// #################################

if (Config.Phone === 'auto') Config.Phone = detectPhone();

function detectPhone() {
    if (GetResourceState('qb-phone') === 'started') return 'qb-phone';
    if (GetResourceState('npwd_qbx_mail') === 'started') return 'npwd_qbx_mail';
    if (GetResourceState('lb-phone') === 'started') return 'lb-phone';
    if (GetResourceState('gksphone') === 'started') return 'gksphone';
    if (GetResourceState('yseries') === 'started') return 'yseries';
    if (GetResourceState('jpr-phonesystem') === 'started') return 'jpr-phonesystem';
    if (GetResourceState('roadphone') === 'started') return 'roadphone';
    return 'custom';
}

// These functions are triggered on the server
Config.SendMail = {
    'qb-phone': (cid, sender, subject, message) => {
        exports['qb-phone'].sendNewMailToOffline(cid, { sender, subject, message });
    },
    'npwd_qbx_mail': (cid, sender, subject, message) => {
        TriggerEvent('qb-phone:server:sendNewMailToOffline', cid, { sender, subject, message });
    },
    'lb-phone': (cid, sender, subject, message) => {
        const phoneNumber = exports["lb-phone"].GetEquippedPhoneNumber(cid);
        const email = exports["lb-phone"].GetEmailAddress(phoneNumber);
        exports["lb-phone"].SendMail({
            to: email,
            sender,
            subject,
            message
        })
    },
    'gksphone': (cid, sender, subject, message) => {
        exports["gksphone"].SendNewMailOffline(cid, {
            sender,
            subject,
            message
        });
    },
    'yseries': (cid, sender, subject, message) => {
        const phoneNumber = exports.yseries.GetPhoneNumberByIdentifier(cid);
        exports.yseries.SendMail({
            title: subject,
            sender,
            senderDisplayName: sender,
            content: message,
        }, 'phoneNumber', phoneNumber);
    },
    'jpr-phonesystem': (cid, sender, subject, message) => {
        exports['jpr-phonesystem'].sendNewMailToOffline(cid, {
            sender,
            subject,
            message,
            button: {}
        });
    },
    'roadphone': (cid, sender, subject, message) => {
        exports['roadphone'].sendMailOffline(cid, {
            sender,
            subject,
            message
        });
    },
    'custom': (cid, sender, subject, message) => {},
}

// #################################
//                                 #
//      INVENTORY INTEGRATION      #
//                                 #
// #################################

if (Config.Inventory === 'auto') Config.Inventory = detectInventory();

function detectInventory() {
    if (GetResourceState('ox_inventory') === 'started') return 'ox_inventory';
    if (GetResourceState('qb-inventory') === 'started') return 'qb-inventory';
    if (GetResourceState('qs-inventory') === 'started') return 'qs-inventory';
    if (GetResourceState('core_inventory') === 'started') return 'core_inventory';
    if (GetResourceState('codem-inventory') === 'started') return 'codem-inventory';
    if (GetResourceState('tgiann-inventory') === 'started') return 'tgiann-inventory';
    if (GetResourceState('ps-inventory') === 'started') return 'ps-inventory';
    return 'custom';
}

// These functions are triggered on the server
Config.OpenEvidence = {
    'ox_inventory': (src, caseId) => {
        const invId = `doj_evidence:${caseId}`;
        exports.ox_inventory.RegisterStash(invId, `D.O.J Evidence - Case #${caseId}`, Config.Evidence.slots, Config.Evidence.weight);
        exports.ox_inventory.forceOpenInventory(src, 'stash', invId);
    },
    'qb-inventory': (src, caseId) => {
        const invId = `doj_evidence:${caseId}`;
        exports['qb-inventory'].CreateInventory(invId, {
            label: `D.O.J Evidence - Case #${caseId}`,
            maxweight: Config.Evidence.weight,
            slots: Config.Evidence.slots
        });
        exports['qb-inventory'].OpenInventory(src, invId);
    },
    'qs-inventory': (src, caseId) => {
        const invId = `doj_evidence:${caseId}`;
        exports['qs-inventory'].RegisterStash(src, invId, Config.Evidence.slots, Config.Evidence.weight) 
    },
    'core_inventory': (src, caseId) => {
        const invId = `doj_evidence:${caseId}`;
        exports.core_inventory.openInventory(src, invId, 'stash', null, null, true, null, false);
    },
    'tgiann-inventory': (src, caseId) => {
        const invId = `doj_evidence:${caseId}`;
        exports["tgiann-inventory"].RegisterStash(invId, `D.O.J Evidence - Case #${caseId}`, Config.Evidence.slots, Config.Evidence.weight);
        exports["tgiann-inventory"].ForceOpenInventory(src, 'stash', invId);
    },
    'ps-inventory': (src, caseId) => {
        const invId = `doj_evidence:${caseId}`;
        exports['ps-inventory'].OpenInventory('stash', invId, {
            maxweight: Config.Evidence.weight,
            slots: Config.Evidence.slots
        }, src);
    },
}

// #################################
//                                 #
//         JAIL INTEGRATION        #
//                                 #
// #################################

if (Config.Jail === 'auto') Config.Jail = detectJail();

function detectJail() {
    if (GetResourceState('xt-prison') === 'started') return 'xt-prison';
    return 'custom';
}

Config.JailPlayer = {
    'xt-prison': (src, timeInMins) => {
        oxTriggerClientCallback('xt-prison:client:enterJail', src, timeInMins);
    },
    'custom': (src, timeInMins) => {}
}
Language configuration

Last updated

Was this helpful?