Qb-policejob with multidepartment support

This is an edited version of qb-policejob, with the support of different police departments, so server owners are not limited to the /setjob police… etc. This creates the ability for server owners to create multiple departments which will have the same functions as the police job.

qb-policejob.rar (1.5 MB)

|-------------------------------------|----------------------------|
| Code is accessible | Yes |
| Lines (approximately) | Number of lines |
| Requirements | None |
| Support | Yes |

2 Likes

hey thanks for sharing, what all did you change? how up to date is your qb-police?

2 Likes

Hey, good question! I changed all client and server.luas as well as the config. The config.lua can be adjusted to your liking. This is the recent version of qb-policejob and will be updated weekly.

1 Like

Looks like the old find PlayerJob.name == 'police' and change it to PlayerJob.type == 'leo'

Though you need to search the entire code base because the anti stress function for police is in QB-Hud. qb-hud/server.lua at main · qbcore-framework/qb-hud · GitHub

So while this will allow you to add a sheriffs department, those sheriffs are still going to get stressed out. I think there are a couple of other checks like in qb-drugs for police numbers. just search the entire code base.

1 Like

I didnt think of that! Would you be able to possible assist with making an edit for qb-hud too to support this? Also, the code you sent is exactly what i did.

Sure i can share that when i get home from work.

1 Like

Alrighty, contact me via github, ive got my socials in my bio.

1 Like

changing all of this and adding new police jobs like dps, doc, doj etc and adding the type = “leo” does not work for me and i looked through and everything is right, i switched my job in game to police and tried to open the trashcan for police that i set with a vector3 in the police config and it will open for police job but when i switch my job to dps with the type dps and go back to try to open the trashcan as the dps job it will not even pop up with my third eye.

Any ideas?

1 Like

oh man my bad i forgot about this thread.

so going off of qb-policejob\server\main.lua i literally just changed anything from .name == "police" to .type == "leo"

local function GetCurrentCops()
    local amount = 0
    local players = QBCore.Functions.GetQBPlayers()
    for _, v in pairs(players) do
        if v and v.PlayerData.job.type == "leo" and v.PlayerData.job.onduty then
            amount += 1
        end
    end
    return amount
end

make sure you type and leo are all lower case since casing matters.

im having an issue with the different jobs i have bcso and sast but nothing seems to work when im that job no armory or anything through the police job there all set like this

I have exactly the same problem, have you managed to find a solution?

Im having same issue

I found and fixed the issue I hope it works for you too. Goto policejob/client and replace job.lua with the job.lua attached and it should fix your issue.
job.lua (38.2 KB)

I show that there is a armory now but it will not actually open the amory for any of the leo jobs i have

I am having this same issue i even replace the job.lu and also the client and nothing

Please update, is this a working script or no?

same
any idea how to fix

I’m getting this code and it’s causing me to have to reassign the job every time someone signs on

works for me Thanks!

yall can just pull the latest qbcore police job because they already have this in it