🏠Custom framework

To adapt the script to another framework, here you can find the functions that need to be adapted

CLIENT

if Config.Core == "custom" then

    -- @return { source: number, indentifier: string | number, job: {onduty: boolean, name: string, grade: { name: string, level: string | number } } }
    FormatPlayer = function(CustomPlayer)
        return {
            source = QBPlayer.source,
            identifier = QBPlayer.citizenid,
            job = {
                onduty = QBPlayer.job.onduty,
                name = QBPlayer.job.name,
                grade = {
                    name = QBPlayer.job.grade.name,
                    level = QBPlayer.job.grade.level
                }
            }
            
        }
    end

    FrameworkFunctions = {
        -- @return { [item: string]: { label: string, weight: number, image?: string } }
        GetItemsInfo = function()
            return {}
        end,

        -- @param { message: string, type: "success" | "info" | "error" }
        Notify = function(message, type)
        end,

        -- @param { model: string, cb: (entity: number) => void, coords: vector3 }
        SpawnVehicle = function(model, cb, coords)
        end,

        -- @return FormatedPlayer
        GetPlayerData = function()
            local player = Custom.GetPlayerData()
            return player and FormatPlayer(player) or false
        end
    }
    
    -- On Player Loaded Event
    RegisterNetEvent('Custom:OnPlayerLoaded', function()
        StartBusienssSystem()
    end)

    -- Your core job update event
    -- @param { JobInfo: { name: string } }
    RegisterNetEvent('Custom:OnJobUpdate', function(JobInfo)
        if string.match(JobInfo.name, Config.JobPrefix) then
            MyBusiness.data = RequestBusinessData()
            if not MyBusiness.data then 
                ClearAllBusinessPoints()
                return
            end
            
            if MyBusiness.PolyZone then
                MyBusiness.PolyZone.destroyed = true
                MyBusiness.PolyZone = nil
            end
            
            MyBusiness.onDuty = JobInfo.onduty
            if MyBusiness.onDuty then
                LoadJobBusinessPoints();
            else
                ClearAllBusinessPoints()
            end
        else
            MyBusiness.data = nil 
            ClearAllBusinessPoints()
        end
    end)
end 

SERVER

πŸ“£ Remember that you can use the other configurations already made as a guide.

Last updated