ZSX Development
  • Homepage to Innovation
  • User Interface V2
    • Installation
      • Introduce
      • Integration for Chat
      • ZSX_Multicharacter Integration
      • Auto Installer
        • About
        • Overextended Library
    • Exports
      • Interfaces
        • Default Notifications
        • Help Notification
        • Notifications
        • Progress Bar
        • TextUI
          • Updating text & key
        • Point
        • Chat
          • AddMessage
          • AddUserMessage
        • 3D DUI
      • Storage
        • Gathering Storage
          • Get Color
          • Get Type
          • Get Options
          • Is Configuration Done
        • Get Current Screen
        • Is UI Busy
        • Gathering position of the interface
      • Threads
        • Interrupting Thread
      • Other
        • DisplayRadar
        • OpenConfiguration
        • OpenMainMenu
        • OpenSettings
        • IsPauseMenuActive
        • IsUIBusy
        • GetCurrentScreen
        • Cinematic
    • Configurating
      • Handling UI
        • Show / Hide UI
        • Disabling Interfaces
        • Disabling Interfaces type
        • Disabling configuration for Interface
        • Creating new status for HUD
        • Changing links
        • Custom Pause Menu Navbar
        • Removing Pause Menu user data
        • Adjusting new voice states
        • Changing between voice indicators
        • Adding new blacklisted weapon
        • Adding blacklist for vehicle model
        • Changing currency
      • Commands
        • Adding commands
      • Translating
        • Translating the resource
        • Adding translation to custom weapons
        • Translating component's type label
      • Handling Data
        • Adding more accounts to Displayers
        • Adding addon elements to Displayers
        • Creating job2 functionality
        • Changing default keybinds
      • AIO Options
      • Camera stuff
        • Creating new preset for Cinematic Mode
        • Creating new scenes for Main Menu
    • Snippets
      • ESX
        • Notification
        • TextUI
        • ShowAdvancedNotification
        • ShowHelpNotification
      • QBCore
        • Notification
        • ProgressBar
  • Multicharacter
    • Installation
      • Setting up the Appearance
      • Setting up the logo
      • Setting up table removal
    • Exports
      • Client
        • GetConfigValue
        • GetUserStorage
        • Logout
        • SetLocationsDisabled
        • isInMulticharacter
        • Initialize
      • Server
        • isInMulticharacter
        • Logout
    • Workers
    • Baseevents
    • FAQ
    • Translating the resource
    • Open source files
    • Common Issues
      • Common
      • ESX
      • Database
      • Other
  • User Interface
    • About
    • Notifications
    • Progressbar
    • Custom Initialization
    • Functions
  • Dealership
    • About
    • Installation
    • Adding a Store
    • Using Exclusive Content
    • Listeners
    • Configuration
Powered by GitBook
On this page
  1. User Interface V2
  2. Configurating
  3. Handling Data

Creating job2 functionality

To create such thing, firstly visit /server/config/player.lua file and find following code:

Make sure that you've already made backend for it!

GetBaseRows = function(source)
    local xPlayer = FrameworkSelected == 'ESX' and ESX.GetPlayerFromId(source) or FrameworkSelected == 'QBCore' and QBCore.Functions.GetPlayer(source) or FrameworkSelected == 'QBOX' and exports['qbox_core']:GetPlayer(source) or false
    local base
    if FrameworkSelected == 'ESX' then
        base = {
            job = {
                type = 'job',
                text = xPlayer.job.name ~= 'unemployed' and (xPlayer.job.label..' - '..xPlayer.job.grade_label) or xPlayer.job.label,
                icon = 'fas fa-briefcase',
                label = xPlayer.job.label,
                grade = xPlayer.job.name == 'unemployed' and '' or xPlayer.job.grade_label
            },
        }
    elseif FrameworkSelected == 'QBOX' or FrameworkSelected == 'QBCore' then
        base = {
            job = {
                type = 'job',
                text = xPlayer.PlayerData.job.name ~= 'unemployed' and (xPlayer.PlayerData.job.label..' - '..xPlayer.PlayerData.job.grade.name) or xPlayer.PlayerData.job.label,
                icon = 'fas fa-briefcase',
                label = xPlayer.PlayerData.job.label,
                grade = xPlayer.PlayerData.job.name == 'unemployed' and '' or xPlayer.PlayerData.job.grade.name
            },
        }
    end
    return base
end

We will be doing example on ESX, here's the revised code:

If you're using some other type of job2 handling, make sure to ask author of the resource how to properly connect it here.

GetBaseRows = function(source)
    local xPlayer = FrameworkSelected == 'ESX' and ESX.GetPlayerFromId(source) or FrameworkSelected == 'QBCore' and QBCore.Functions.GetPlayer(source) or FrameworkSelected == 'QBOX' and exports['qbox_core']:GetPlayer(source) or false
    local base
    if FrameworkSelected == 'ESX' then
        base = {
            job = {
                type = 'job',
                text = xPlayer.job.name ~= 'unemployed' and (xPlayer.job.label..' - '..xPlayer.job.grade_label) or xPlayer.job.label,
                icon = 'fas fa-briefcase',
                label = xPlayer.job.label,
                grade = xPlayer.job.name == 'unemployed' and '' or xPlayer.job.grade_label
            },
            --Example of adding more rows [job2 example]
            job2 = {
                type = 'job',
                text = xPlayer.job2.name ~= 'unemployed' and (xPlayer.job2.label..' - '..xPlayer.job2.grade_label) or xPlayer.job2.label,
                icon = 'fas fa-briefcase',
            },
        }
    elseif FrameworkSelected == 'QBOX' or FrameworkSelected == 'QBCore' then
        base = {
            job = {
                type = 'job',
                text = xPlayer.PlayerData.job.name ~= 'unemployed' and (xPlayer.PlayerData.job.label..' - '..xPlayer.PlayerData.job.grade.name) or xPlayer.PlayerData.job.label,
                icon = 'fas fa-briefcase',
                label = xPlayer.PlayerData.job.label,
                grade = xPlayer.PlayerData.job.name == 'unemployed' and '' or xPlayer.PlayerData.job.grade.name
            },
        }
    end
    return base
end

And that's it!

PreviousAdding addon elements to DisplayersNextChanging default keybinds

Last updated 5 months ago