Skip to content

โ†— Shared Exports

Function or EventScopeDescriptionreturns
exports['qb-core']:AddItem(itemName, item)ServerAccepts an item name and item object - will add new entry to QBCore.Shared.Itemsboolean, string
exports['qb-core']:AddJob(jobName, job)ServerAccepts an job name and job object - will add new entry to QBCore.Shared.Jobsboolean, string
exports['qb-core']:AddGang(gangName, gang)ServerAccepts an gang name and gang object - will add new entry to QBCore.Shared.Gangsboolean, string
exports['qb-core']:AddItems(items)ServerAccepts a table or array - will loop through the table and add new entries to QBCore.Shared.Itemsboolean, string, errorItem
exports['qb-core']:AddJobs(jobs)ServerAccepts a table or array - will loop through the table and add new entries to QBCore.Shared.Jobsboolean, string, errorItem
exports['qb-core']:AddGangs(gangs)ServerAccepts a table or array - will loop through the table and add new entries to QBCore.Shared.Gangsboolean, string, errorItem
QBCore.Functions.AddItem(itemName, item)ServerAccepts an item name and item object - will add new entry to QBCore.Shared.Itemsboolean, string
QBCore.Functions.AddJob(jobName, Job)ServerAccepts an job name and job object - will add new entry to QBCore.Shared.Jobsboolean, string
QBCore.Functions.AddGang(gangName, gang)ServerAccepts an gang name and gang object - will add new entry to QBCore.Shared.Gangsboolean, string
QBCore.Functions.AddItems(items)ServerAccepts a table or array - will loop through the table and add new entries to QBCore.Shared.Itemsboolean, string, errorItem
QBCore.Functions.AddJobs(jobs)ServerAccepts a table or array - will loop through the table and add new entries to QBCore.Shared.Jobsboolean, string, errorItem
QBCore.Functions.AddGangs(gangs)ServerAccepts a table or array - will loop through the table and add new entries to QBCore.Shared.Gangsboolean, string, errorItem
TriggerServerEvent('QBCore:Sever:UpdateObject')ServerAccepts nothing - used to update the core object (PLEASE USE THE BELOW EXAMPLE)none
TriggerClientEvent('QBCore:Client:UpdateObject')ClientAccepts nothing - used to update the core object (PLEASE USE THE BELOW EXAMPLE)none

Import Jobs

  • This method allows for any resource to insert job data into the shared file for the core. That means that you can make a resource, and on load, make those jobs available for use. This can be accomplished through one the ways shown below. Utilizing the function requires importing the core but using the export does not
RegisterNetEvent('QBCore:Client:UpdateObject', function()
	QBCore = exports['qb-core']:GetCoreObject()
end)
RegisterNetEvent('QBCore:Server:UpdateObject', function()
	if source ~= '' then return false end
	QBCore = exports['qb-core']:GetCoreObject()
end)

QBCore.Functions.AddJob

QBCore.Functions.AddJob(jobName --[[string]], job --[[table]])

-- Example
QBCore.Functions.AddJob('unemployed', {
    label = 'Civilian',
    defaultDuty = true,
    offDutyPay = false,
    grades = {
        ['0'] = {
            name = 'Freelancer',
            payment = 10
        }
    }
})

exports[โ€˜qb-coreโ€™]

exports['qb-core']:AddJob(jobName --[[string]], job --[[table]])

-- Example
exports['qb-core']:AddJob('unemployed', {
    label = 'Civilian',
    defaultDuty = true,
    offDutyPay = false,
    grades = {
        ['0'] = {
            name = 'Freelancer',
            payment = 10
        }
    }
})

QBCore.Functions.AddJobs

QBCore.Functions.AddJobs(jobs --[[table]])

-- Example
QBCore.Functions.AddJobs({
    ['unemployed'] = {
        label = 'Civilian',
        defaultDuty = true,
        offDutyPay = false,
        grades = {
            ['0'] = {
                name = 'Freelancer',
                payment = 10
        }
    },
    ['trucker'] = {
	label = 'Trucker',
	defaultDuty = true,
	offDutyPay = false,
	grades = {
            ['0'] = {
                name = 'Driver',
                payment = 50
        }
    }
})

exports[โ€˜qb-coreโ€™]

exports['qb-core']:AddJobs(jobs --[[table]])

-- Example
exports['qb-core']:AddJobs({
    ['unemployed'] = {
        label = 'Civilian',
        defaultDuty = true,
        offDutyPay = false,
        grades = {
            ['0'] = {
                name = 'Freelancer',
                payment = 10
        }
    },
    ['trucker'] = {
	label = 'Trucker',
	defaultDuty = true,
	offDutyPay = false,
	grades = {
            ['0'] = {
                name = 'Driver',
                payment = 50
        }
    }
})

Import Gangs

  • This method allows for any resource to insert gang data into the shared file for the core. That means that you can make a resource, and on load, make those gangs available for use. This can be accomplished through one the ways shown below. Utilizing the function requires importing the core but using the export does not

QBCore.Functions.AddGang

QBCore.Functions.AddGang(gangName --[[string]], gang --[[table]])

-- Example
QBCore.Functions.AddGang('azteca', {
    label = 'Azteca',
    grades = {
        ['0'] = {
            name = 'Recruit'
        }
    }
})

exports[โ€˜qb-coreโ€™]

exports['qb-core']:AddGang(gangName --[[string]], gang --[[table]])

-- Example
exports['qb-core']:AddGang('azteca', {
    label = 'Azteca',
    grades = {
        ['0'] = {
            name = 'Recruit'
        }
    }
})

QBCore.Functions.AddGangs

QBCore.Functions.AddGangs(gangs --[[table]])

-- Example
QBCore.Functions.AddGangs({
    ['lostmc'] = {
        label = 'Lost MC',
        grades = {
            ['0'] = {
                name = 'Recruit'
            }
        }
    },
    ['ballas'] = {
        label = 'Ballas',
        grades = {
            ['0'] = {
                name = 'Recruit'
            }
        }
    }
})

exports[โ€˜qb-coreโ€™]

exports['qb-core']:AddGangs(gangs --[[table]])

-- Example
exports['qb-core']:AddGangs({
    ['lostmc'] = {
        label = 'Lost MC',
        grades = {
            ['0'] = {
                name = 'Recruit'
            }
        }
    },
    ['ballas'] = {
        label = 'Ballas',
        grades = {
            ['0'] = {
                name = 'Recruit'
            }
        }
    }
})

Import Items

  • This method allows for any resource to insert item data into the shared file for the core. That means that you can make a resource, and on load, make those items available for use. This can be accomplished through one the ways shown below. Utilizing the function requires importing the core but using the export does not

QBCore.Functions.AddItem

QBCore.Functions.AddItem(itemName --[[string]], item --[[table]])

-- Example
QBCore.Functions.AddItem('water_bottle', {
    name = 'water_bottle',
    label = 'Bottle of Water',
    weight = 10,
    type = 'item',
    image = 'water_bottle.png',
    unique = false,
    useable = true,
    shouldClose = true,
    combinable = nil,
    description = 'For all the thirsty out there'
})

exports[โ€˜qb-coreโ€™]

exports['qb-core']:AddItem(itemName --[[string]], item --[[table]])

-- Example
exports['qb-core']:AddItem('water_bottle', {
    name = 'water_bottle',
    label = 'Bottle of Water',
    weight = 10,
    type = 'item',
    image = 'water_bottle.png',
    unique = false,
    useable = true,
    shouldClose = true,
    combinable = nil,
    description = 'For all the thirsty out there'
})

QBCore.Functions.AddItems

QBCore.Functions.AddItems(items --[[table]])

-- Example
QBCore.Functions.AddItems({
    ['water_bottle'] = {
        name = 'water_bottle',
        label = 'Bottle of Water',
        weight = 10,
        type = 'item',
        image = 'water_bottle.png',
        unique = false,
        useable = true,
        shouldClose = true,
        combinable = nil,
        description = 'For all the thirsty out there'
    },
    ['sandwich'] = {
        name = 'sandwich',
        label = 'Sandwich',
        weight = 10,
        type = 'item',
        image = 'sandwich.png',
        unique = false,
        useable = true,
        shouldClose = true,
        combinable = nil,
        description = 'Nice bread for your stomach'
    }
})

exports[โ€˜qb-coreโ€™]

exports['qb-core']:AddItems(items --[[table]])

-- Example
exports['qb-core']:AddItems({
    ['water_bottle'] = {
        name = 'water_bottle',
        label = 'Bottle of Water',
        weight = 10,
        type = 'item',
        image = 'water_bottle.png',
        unique = false,
        useable = true,
        shouldClose = true,
        combinable = nil,
        description = 'For all the thirsty out there'
    },
    ['sandwich'] = {
        name = 'sandwich',
        label = 'Sandwich',
        weight = 10,
        type = 'item',
        image = 'sandwich.png',
        unique = false,
        useable = true,
        shouldClose = true,
        combinable = nil,
        description = 'Nice bread for your stomach'
    }
})