cl_config.lua

Preview

--[[ ===================================================================
    NOTIFICATION SYSTEM 
    ===================================================================
    Function to display notifications to the player
    Supports both ESX and QBCore frameworks and various notification systems
    
    HOW TO USE:
    - Uncomment the notification system you want to use
    - Make sure you have the corresponding resource installed
    - For custom notification systems, add your own line and comment out others
]]--

function Notify(message)
    -- Process localization if necessary
    -- If message is a localization key, it will be translated to the chosen language
    local displayMessage = message
    
    -- Check if the message is a localization key
    if Locales and Config.Locale and type(message) == "string" and 
       Locales[Config.Locale] and Locales[Config.Locale][message] then
        displayMessage = Locales[Config.Locale][message]
    end
    
    -- NOTIFICATION SYSTEMS - UNCOMMENT YOUR PREFERRED SYSTEM
    
    -- ESX Default
    ESX.ShowNotification(displayMessage)
    
    -- QBCore
    -- QBCore.Functions.Notify(displayMessage, 'success')
    
    -- Other popular notification systems - uncomment your preferred one
    -- exports['okokNotify']:Alert("Staff Mode", displayMessage, 5000, 'info')
    -- exports['mythic_notify']:SendAlert('inform', displayMessage)
    -- TriggerEvent('codem-notification:Create', displayMessage, 'info', nil, 5000)
    -- exports['Roda_Notifications']:showNotify(displayMessage, 'info', 5000)
end

--[[ ===================================================================
    STAFF OUTFIT SYSTEM
    ===================================================================
    Function to apply the staff outfit when entering staff mode
    Supports both ESX and QBCore frameworks
    
    The outfit settings are defined in config.lua
]]--

function SetStaffOutfit()
    local playerPed = PlayerPedId()
    
    -- ESX FRAMEWORK IMPLEMENTATION
    if Config.Framework == 'esx' then
        -- Store current outfit before changing
        TriggerEvent('skinchanger:getSkin', function(skin)
            lastSkin = skin
            -- Select outfit based on gender (0 = male, 1 = female)
            local outfit = skin.sex == 0 and Config.StaffOutfit.male or Config.StaffOutfit.female
            TriggerEvent('skinchanger:loadClothes', lastSkin, outfit)
        end)
    
    -- QBCORE FRAMEWORK IMPLEMENTATION
    elseif Config.Framework == 'qb' then
        local QBCore = exports['qb-core']:GetCoreObject()
        local Player = QBCore.Functions.GetPlayerData()
        
        -- Check player gender (0 = male, 1 = female)
        local gender = Player.charinfo.gender
        local outfitData = gender == 0 
            and Config.StaffOutfit.qbcore.male.outfitData 
            or Config.StaffOutfit.qbcore.female.outfitData
        
        -- Save outfit in database if needed
        TriggerServerEvent('qb-clothing:server:saveOutfit', 'staff_mode', outfitData)
        
        -- Store current outfit for later restoration
        lastOutfit = Player.metadata.outfit
        
        -- Apply the staff outfit
        TriggerEvent('qb-clothing:client:loadOutfit', outfitData)
    end
end

Last updated

Was this helpful?