Full View config.client.lua

if Config.Core == "ESX" then
    RegisterNetEvent(Config.PlayerSetJob)
    AddEventHandler(Config.PlayerSetJob, function(PLAYER_JOB)
        PlayerData.job = PLAYER_JOB
        reloadPlayerBlips()
    end)

    RegisterNetEvent(Config.PlayerSetGang)
    AddEventHandler(Config.PlayerSetGang, function(PLAYER_GANG)
        PlayerData.job2 = PLAYER_GANG
        reloadPlayerBlips()
    end)
elseif Config.Core == "QB-Core" then
    RegisterNetEvent(Config.PlayerSetJob)
    AddEventHandler(Config.PlayerSetJob, function(PLAYER_JOB)
        PlayerData.job = PLAYER_JOB
        reloadPlayerBlips()
    end)

    RegisterNetEvent(Config.PlayerSetGang)
    AddEventHandler(Config.PlayerSetGang, function(PLAYER_GANG)
        PlayerData.gang = PLAYER_GANG
        reloadPlayerBlips()
    end)
end

CL = {}

CL.getPlayerJob = function(type)
    if Config.Core == "ESX" then
        if type == "table" and PlayerData.job then
            return PlayerData.job
        end
        if type == "label" and PlayerData.job.label then
            return PlayerData.job.label
        end
        if type == "name" and PlayerData.job.name then
            return PlayerData.job.name
        end
        if type == "grade_name" and PlayerData.job.grade_name then
            return PlayerData.job.grade_name
        end
    elseif Config.Core == "QB-Core" then
        if type == "table" and PlayerData.job then
            return PlayerData.job
        end
        if type == "label" and PlayerData.job.label then
            return PlayerData.job.label
        end
        if type == "name" and PlayerData.job.name then
            return PlayerData.job.name
        end
        if type == "grade_name" and PlayerData.job.grade.name then
            return PlayerData.job.grade.name
        end
    end
    return nil
end

CL.getPlayerGang = function(type)
    if Config.Core == "ESX" then
        if type == "table" and PlayerData.job2 then
            return PlayerData.job2
        end
        if type == "label" and PlayerData.job2.label then
            return PlayerData.job2.label
        end
        if type == "name" and PlayerData.job2.name then
            return PlayerData.job2.name
        end
        if type == "grade_name" and PlayerData.job2.grade_name then
            return PlayerData.job2.grade_name
        end
    elseif Config.Core == "QB-Core" then
        if type == "table" and PlayerData.gang then
            return PlayerData.gang
        end
        if type == "label" and PlayerData.gang.label then
            return PlayerData.gang.label
        end
        if type == "name" and PlayerData.gang.name then
            return PlayerData.gang.name
        end
        if type == "grade_name" and PlayerData.gang.grade.name then
            return PlayerData.gang.grade.name
        end
    end
    return nil
end

CL.OpenTuningMenu = function() -- Add your trigger or export to open Tuning Menu from your script.
    exports['esx_lscustom']:openTuning()
    -- HERE ADD CODE TO OPEN YOUR TUNING MENU

end

CL.OpenGarage = function() -- Add your trigger or export to open Garage from your script.
    -- HERE ADD CODE TO OPEN YOUR GARAGE
    
end

CL.OpenSociety = function(isJob)
    if Config.Society == "esx_society" then
        TriggerEvent('esx_society:openBossMenu', isJob and CL.getPlayerJob('name') or CL.getPlayerGang('name'), {wash = false})
    elseif Config.Society == "qb-management" then
        TriggerEvent(isJob and 'qb-bossmenu:client:OpenMenu' or 'qb-gangmenu:client:OpenMenu')
    elseif Config.Society == "other" then
        -- HERE ADD CODE TO OPEN YOUR OTHER BOSS MENU

    end
end

CL.OpenStorage = function(job, stashId, societyName) -- Only use with Config.Storage - 'qb', 'qs', 'other'
    if Config.Storage == "qb" then
        TriggerServerEvent("inventory:server:OpenInventory", "stash", "Storage_"..job..'_'..stashId, {maxweight = Config.StorageOptions.maxweight, slots = Config.StorageOptions.slots})
        TriggerEvent("inventory:client:SetCurrentStash", "Storage_"..job..'_'..stashId)
    elseif Config.Storage == "qs" then
        TriggerServerEvent("inventory:server:OpenInventory", "stash", "Storage-"..job..'-'..stashId)
    elseif Config.Storage == "other" then
        -- HERE YOU CAN ADD CODE TO OPEN YOUR OTHER INVENTORY
        
    end
end

CL.useFastMenu = function(type, job, value, element)
    if value == "show_badge" then
        if job == "ambulance" then
            TriggerEvent("vms_document:showMyDocument", "ambulance_badge")

        elseif job == "police" then
            TriggerEvent("vms_document:showMyDocument", "police_badge")

        elseif job == "sheriff" then
            -- TriggerEvent("vms_document:showMyDocument", "id_card")

        end
    elseif value == "revive" then
        TriggerEvent('vms_jobs:menu:revive') -- config/your_client_code.lua

    elseif value == "heal" then
        TriggerEvent('vms_jobs:menu:heal') -- config/your_client_code.lua
        
    elseif value == "handcuffs" then
        TriggerEvent('vms_jobs:menu:handcuffs') -- config/your_client_code.lua
        
    elseif value == "clean_vehicle" then
        TriggerEvent('vms_jobs:menu:clean_vehicle') -- config/your_client_code.lua

    elseif value == "repair_vehicle" then
        TriggerEvent('vms_jobs:menu:repair_vehicle') -- config/your_client_code.lua

    elseif value == "impound_vehicle" then
        TriggerEvent('vms_jobs:menu:impound_vehicle') -- config/your_client_code.lua

    -- elseif value == "place_object" then
    --     TriggerEvent('vms_jobs:menu:place_object', element.object) -- config/your_client_code.lua

    end
end

Last updated