tom-osborne / qb-speedcameras

A simple, optimised and configurable speed camera script.
55 stars 7 forks source link

dont work #12

Closed Cupidojex closed 1 year ago

Cupidojex commented 1 year ago

see nothing

tom-osborne commented 1 year ago

make sure your core is up to date and includes thne client side vehicle entering event handlers.

Cupidojex commented 1 year ago

i have qbcore cersion 1.1.0

tom-osborne commented 1 year ago

qbcore do not version control their code, so that doesnt mean anything

Make sure you have this code: https://github.com/qbcore-framework/qb-core/blob/main/client/events.lua#LL162-L181

If you dont, copy it into your core.

Cupidojex commented 1 year ago

When the police or the drivers that the vehicles are not theirs take a radar, they get a blank screen when they go through a radar and they notify the police, even if it is the same agent that passes by, it can be fixed somehow ?

tom-osborne commented 1 year ago

When the police or the drivers that the vehicles are not theirs take a radar, they get a blank screen when they go through a radar and they notify the police, even if it is the same agent that passes by, it can be fixed somehow ?

Yes, this is easily fixed by setting the option config.OnlyBillifOwned = true https://github.com/tom-osborne/qb-speedcameras/blob/main/config.lua#L10

The players might still see the flash, but they will not be fined.

Cupidojex commented 1 year ago

That's how it is set, but it's not normal for even the police to see it. is what I'm telling you

tom-osborne commented 1 year ago

Make sure the correct job is listed in the ignored jobs

Cupidojex commented 1 year ago

yea, police.

tom-osborne commented 1 year ago

Have you done any troubleshooting at all?

Cupidojex commented 1 year ago

image i put a print in the function. u see?

Cupidojex commented 1 year ago

image

tom-osborne commented 1 year ago
---Checks whether the player's job is in the Config.ignoredJobs table.
---@return boolean
local function isJobExempt()
    local playerJob = PlayerData.job
    print(playerJob.name, playerJob.onduty)
    if not playerJob then return false end
    for _, job in pairs(Config.ignoredJobs) do
        if playerJob.name == job and playerJob.onduty then return true end
    end
    return false
end

Add the line as shown above. This should print into your client console police true

Then, also add this print into the main loop:

---Main loop to check player speed when in vehicle and detect when caught speeding
local function monitorSpeed()
    CreateThread(function()
        monitoringSpeed = true
        local sleep
        print("isJobExempt()", isJobExempt())
        if isJobExempt() then return end

This should also print true if you have a job that should be ignored.

Cupidojex commented 1 year ago

print false but the police is onduty and have the job police... why?

tom-osborne commented 1 year ago

I suspect it might not be getting your duty status correctly. If you go on/off duty does it fix it?

Cupidojex commented 1 year ago

no, if yu go on/off print false

tom-osborne commented 1 year ago

What about when you do command /duty?

tom-osborne commented 1 year ago

Try replacing the function like this:

---Checks whether the player's job is in the Config.ignoredJobs table.
---@return boolean
local function isJobExempt()
    local Player = QBCore.Functions.GetPlayerData()
    local playerJob = Player.job
    if not playerJob then return false end
    for _, job in pairs(Config.ignoredJobs) do
        if playerJob.name == job and playerJob.onduty then return true end
    end
    return false
end