🔁Exports & Events
HasInspection
Checks if a vehicle has a valid, expired, or no inspection based on its plate.
local status, expiresAt = exports['m-Inspection']:HasInspection(plate)
if status == "valid" then
print("Valid inspection, expires: " .. os.date('%Y-%m-%d %H:%M:%S', expiresAt))
elseif status == "expired" or status == "invalid" then
print("Invalid or expired inspection")
else
print("No inspection")
end
GetPlayerInspections
Retrieves all inspections linked to a specific citizen ID.
local identifier = 'identifier or citizenid' -- Identifier or citizen id
local inspections = exports['m-Inspection']:GetPlayerInspections(citizenid)
for _, inspection in ipairs(inspections) do
print(('Plate: %s | Status: %s | Expire at: %s'):format(inspection.plate, inspection.status, os.date('%d/%m/%Y', inspection.expires_at)))
end
CreateInspection
Creates a new inspection for a specific plate and sets its expiration based on the number of days.
local plate = 'ABC1234' -- Vehicle plate
local identifier = 'identifier or citizenid' -- Identifier or citizen id
local vehicleModel = 'sultan' -- Vehicle model
local days = 7 -- Number of days
local insertId = exports['m-Inspection']:CreateInspection(plate, citizenid, vehicleModel, days)
if insertId then
print('Inspection created successfully. ID:', insertId)
else
print('Error creating inspection.')
end
RemoveInspection
Removes the most recent inspection for a specific plate, if it exists.
local plate = 'ABC1234' -- Vehicle plate
local removed = exports['m-Inspection']:RemoveInspection(plate)
if removed then
print('Inspection removed successfully.')
else
print('No inspection found to remove.')
end
UpdateInspectionStatus
Updates the status of the latest inspection for a given plate (e.g., to
expired
,valid
,invalid
).
local plate = 'ABC1234' -- Vehicle plate
local newStatus = 'expired' -- or 'valid', 'invalid', etc.
local updated = exports['m-Inspection']:UpdateInspectionStatus(plate, novoStatus)
if updated then
print('Inspection status updated to: ', novoStatus)
else
print('Error updating status. No inspections found.')
end
Last updated