This is just from me reading docs and stuff so its to the best of my knowledge.
At the stop of your script make sure to ALWAYS add.
local QBCore = exports['qb-core']:GetCoreObject()
These might some problems that could cause it though.
exports['qb-core']:AddJob(jobName, job)
Server
boolean, string
--[[ Accepts an job name and job object will add new entry to QBCore.Shared.Jobs]]
This function is expected to be defined on the server side.
If wanting to use on client, pass the args through to server side.
QBCore.Functions.AddJob
Make sure to have AddJob
as the right capitalization.
ensure qb-core
Make sure to ensure qb-core
before your script.
You can also use this to guide you.
This is a quick example!
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.AddJob('hotdog', { --[[Job you want]]
label = 'HotDoggy',
defaultDuty = true,
offDutyPay = false,
grades = {
['0'] = {
name = 'Glizzy',
payment = 10
}
}
})
Event Usage Example
Server script
local QBCore = exports['qb-core']:GetCoreObject()
-- Command registration
RegisterCommand("addjob", function(source, args, rawCommand)
TriggerServerEvent('testy')
end, false)
-- Server event
RegisterNetEvent('testy', function()
QBCore.Functions.AddJob('hotdog', {
label = 'HotDoggy',
defaultDuty = true,
offDutyPay = false,
grades = {
['0'] = {
name = 'Glizzy',
payment = 10
}
}
})
end)
Hope this helps as I know you probably have tried this.
(The code I showed may or may not work as I DID NOT test it. )