[QB] Turning Jobs into Side-jobs

,

Is there a way to turn 2 or 3 jobs that are available at City Halls into Side-Jobs? The jobs that i was looking for is the Hotdog Seller, Trucker or Bus Driver. It is to let those who already have a job (like the Police, EMS etc) to do side-jobs (Hotdogs, Bus Driver or Trucker) without letting go their current job.

Currently, those who already have a job (Police or EMS), if they accepted another job, they will lose their current jobs and they need to re-apply to their bosses so that they(the boss) can re-hire them into the force. I want to avoid this.

or, Disable the need to get a Job at the City Hall and anyone can just do the Job (except the whitelisted jobs) at their respective jobcentre (eg, Bus Driver at Bus Station). I know nothing about scripting, so i kinda need help.

-Sorry for my bad English-

1 Like

Yes you can edit those resources and remove the portions of code which typically say

“if PlayerJob == ‘jobname’ then”

do i replace ‘jobname’ to ‘none’ or ‘all’ ?

No you just remove the line and the accompanying end

Tried removing all portions of code that contains this, nothing happens. Now, if a player apply for the job, it won’t even appear at the base.

The changes i made

Original

– Events

RegisterNetEvent(‘QBCore:Client:OnPlayerLoaded’, function()
PlayerJob = QBCore.Functions.GetPlayerData().job
CurrentLocation = nil
CurrentBlip = nil
hasBox = false
isWorking = false
JobsDone = 0
if PlayerJob.name == “trucker” then
CreateElements()
end

end)

RegisterNetEvent(‘QBCore:Client:OnPlayerUnload’, function()
RemoveTruckerBlips()
CurrentLocation = nil
CurrentBlip = nil
hasBox = false
isWorking = false
JobsDone = 0
end)

RegisterNetEvent(‘QBCore:Client:OnJobUpdate’, function(JobInfo)
local OldPlayerJob = PlayerJob.name
PlayerJob = JobInfo

if PlayerJob.name == "trucker" then
    CreateElements()
end
if OldPlayerJob == "trucker" then
    RemoveTruckerBlips()
end

end)

RegisterNetEvent(‘qb-truckerjob:client:ShowMarker’, function(active)
if PlayerJob.name == “trucker” then
showMarker = active
end
end)

RegisterNetEvent(‘qb-truckerjob:client:SetDelivering’, function(active)
if PlayerJob.name == “trucker” then
Delivering = active
end
end)

main.lua (16.5 KB)

To

– Events

RegisterNetEvent(‘QBCore:Client:OnPlayerLoaded’, function()
PlayerJob = QBCore.Functions.GetPlayerData().job
CurrentLocation = nil
CurrentBlip = nil
hasBox = false
isWorking = false
JobsDone = 0
end)

RegisterNetEvent(‘QBCore:Client:OnPlayerUnload’, function()
RemoveTruckerBlips()
CurrentLocation = nil
CurrentBlip = nil
hasBox = false
isWorking = false
JobsDone = 0
end)

RegisterNetEvent(‘QBCore:Client:OnJobUpdate’, function(JobInfo)
local OldPlayerJob = PlayerJob.name
PlayerJob = JobInfo
end)

RegisterNetEvent(‘qb-truckerjob:client:ShowMarker’, function(active)
end)

RegisterNetEvent(‘qb-truckerjob:client:SetDelivering’, function(active)
end)

main.lua (16.1 KB)

Only thing is, i only saw the lines at client/main.lua. The rest was untouched (so basically like the original).

You removed code inside the if statement.

Example

RegisterNetEvent(‘qb-truckerjob:client:SetDelivering’, function(active)

if PlayerJob.name == "truckker" then--remove this line

Delivering = active --keep this line

end--remove this line

end)

Follow this throughout.

Thanks for the reply, i want to confirm.

– Events

RegisterNetEvent(‘QBCore:Client:OnPlayerLoaded’, function()
PlayerJob = QBCore.Functions.GetPlayerData().job
CurrentLocation = nil
CurrentBlip = nil
hasBox = false
isWorking = false
JobsDone = 0
--if PlayerJob.name == “trucker” then
CreateElements()
--end

end)

RegisterNetEvent(‘QBCore:Client:OnPlayerUnload’, function()
RemoveTruckerBlips()
CurrentLocation = nil
CurrentBlip = nil
hasBox = false
isWorking = false
JobsDone = 0
end)

RegisterNetEvent(‘QBCore:Client:OnJobUpdate’, function(JobInfo)
local OldPlayerJob = PlayerJob.name
PlayerJob = JobInfo

--if PlayerJob.name == "trucker" then
    CreateElements()
--end
--if OldPlayerJob == "trucker" then
    RemoveTruckerBlips()
--end

end)

RegisterNetEvent(‘qb-truckerjob:client:ShowMarker’, function(active)
--if PlayerJob.name == “trucker” then
showMarker = active
--end
end)

RegisterNetEvent(‘qb-truckerjob:client:SetDelivering’, function(active)
--if PlayerJob.name == “trucker” then
Delivering = active
--end
end)

is this correct? but there’s line that i have doubt, it’s this

--if OldPlayerJob == "trucker" then
    RemoveTruckerBlips()
--end

should i remove all 3 lines or do the same like what you said?

Or just get a multijob script then pd can switch jobs anyway

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.