Kartik Scripts

Get Penal Codes

Returns penal code entries registered in the MDT database.

Export Syntax

exports['kartik-mdt']:GetPenalCodes(department, query)

Parameters

ParameterTypeRequiredDefaultDescription
departmentstring or nilNonilOptional filter by department name (e.g. "police")
querystring or nilNonilOptional search query matching penal code titles or categories

Return Value

  • Returns table containing an array of matched penal codes:
{
    {
        id                = number,
        title             = string,
        category          = string,
        fine              = number,
        jail              = number,
        description       = string,
        strike_weight     = number,
        community_service = number,
        probation         = number,
        parole            = number,
        department        = string,
    },
    ...
}

Example Usage

-- Get all penal codes containing "theft" in LSPD
local codes = exports['kartik-mdt']:GetPenalCodes("police", "theft")

print(string.format("Found %d matching penal codes:", #codes))
for _, code in ipairs(codes) do
    print(string.format("- [%s] %s | Fine: $%d | Jail: %d months", code.category, code.title, code.fine, code.jail))
end

On this page