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

Adding addon elements to Displayers

In recent updates we gave an ability to add custom element to the displayers that will appear in 3rd column. In order to add one follow example below.

Every update needs to be called to the server side in order to apply the change for the player.

In the current version such updates can be hard to do for beginners but we're maintaining the resource.

So, let's say you want to add some custom watermark on the displayers that will display your server name. Headover to the server/components/players.lua and find Players.SetData function.

Inside of that function there's an object data.addon = {} which represents the addon object.

Players.SetData = function(src)
    local xPlayer = FrameworkSelected == 'ESX' and ESX.GetPlayerFromId(src) or FrameworkSelected == 'QBCore' and QBCore.Functions.GetPlayer(src) or FrameworkSelected == 'QBOX' and exports['qbox_core']:GetPlayer(source) or false
    local data = {}
    if not xPlayer then return --[[not possible]] end
    if FrameworkSelected == 'ESX' then
        data.firstname = xPlayer.variables.firstName
        data.lastname = xPlayer.variables.lastName
    elseif FrameworkSelected == 'QBOX' or FrameworkSelected == 'QBCore' then
        data.firstname = xPlayer.PlayerData.charinfo.firstname
        data.lastname = xPlayer.PlayerData.charinfo.lastname
    end
    data.base = GetBaseRows(src)
    data.id = src
    data.wallets = GetUserWallets(src)
    -- added change
    data.addon = {
        watermark = {
            text = "My Server Name",
            icon = "fas fa-server"
        }
    }
    --
    Players.GlobalData[tostring(src)] = data
    TriggerClientEvent('ZSX_UIV2:Client:PlayerInitialized', src)
    debugPrint('[^2PLAYER^7] Succesfully set player data for ['..src..'] ('..GetPlayerName(src)..')')
    Player(src).state:set('UI_UserData', data, true)
end

In the above code we've applied data.addon object to show the watermark - simple as that!

PreviousAdding more accounts to DisplayersNextCreating job2 functionality

Last updated 19 days ago