#QBX Police Script Error
1 messages · Page 1 of 1 (latest)
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
This happens because the player parameter given to the function is not a valid player.
Not sure what it is that's triggering it but this should stop the errors from printing at least.
sure
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)
BTW I updated the fix for the previous one
I think minGrade is optional so do change it to that
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!
Thank you!