#QBX Police Script Error

1 messages · Page 1 of 1 (latest)

gray bone
#

I am getting this error. Not sure what is triggering it or what it is not doing right

12:44:46 AM [ script:qbx_police] SCRIPT ERROR: @qbx_police/server/main.lua:14: attempt to index a nil value (local 'player')

LINE 14 IN qbx_police/server/main.lua: local job = player.PlayerData.job

ebon briar
#

Replace the function at server/main.lua line 13 with this:

function IsLeoAndOnDuty(player, minGrade)
    if not player then return false end
    local job = player.PlayerData.job
    if job and job.type == 'leo' and job.onduty then
        return job.grade.level >= (minGrade or 0)
    end
end
ebon briar
#

Not sure what it is that's triggering it but this should stop the errors from printing at least.

gray bone
#

Hey thank you!

#

Think you might have a fix for one more?

ebon briar
gray bone
#

SCRIPT ERROR: @qbx_mechanicjob/server/main.lua:96: table index is nil

LINE 96

vehicleStatus[plate] = statusInfo TriggerClientEvent("vehiclemod:client:setVehicleStatus", -1, plate, statusInfo) end)

ebon briar
#

BTW I updated the fix for the previous one

#

I think minGrade is optional so do change it to that

ebon briar
# gray bone SCRIPT ERROR: @qbx_mechanicjob/server/main.lua:96: table index is nil LINE 96 ...
RegisterNetEvent('vehiclemod:server:setupVehicleStatus', function(plate, engineHealth, bodyHealth)
    if not plate then return end
    engineHealth = engineHealth or 1000.0
    bodyHealth = bodyHealth or 1000.0

    local statusInfo = vehicleStatus[plate] or getVehicleStatus(plate) or
        {
            engine = engineHealth,
            body = bodyHealth,
            radiator = sharedConfig.maxStatusValues.radiator,
            axle = sharedConfig.maxStatusValues.axle,
            brakes = sharedConfig.maxStatusValues.brakes,
            clutch = sharedConfig.maxStatusValues.clutch,
            fuel = sharedConfig.maxStatusValues.fuel
        }

    vehicleStatus[plate] = statusInfo
    TriggerClientEvent("vehiclemod:client:setVehicleStatus", -1, plate, statusInfo)
end)
#

This just means that you are essentially trying to access

vehicleStatus[nil] -- Plate is nil 
#

Anyways gotta go man good luck!

gray bone