Kartik Scripts

Update Citizen License

*

updateCitizenLicense(source, data)

Updates or creates a license record for a specific citizen in the system.


Parameters

source

Type: number
Description: The source player ID from which the request is initiated.


data

Type: table
Description: Contains the citizen ID and license information to be updated or inserted.


Fields within data

data.citizenId

Type: string
Required: ✅
Description: The unique identifier for the citizen whose license record is being updated or created.


data.license

Type: table
Required: ✅
Description: Contains details of the license being created or modified.


Fields within data.license

FieldTypeRequiredDescription
typestring✅Type of license (e.g., "driver", "weapon").
namestring✅Name of the license.
statusstring✅Status of the license. Accepted values: "approved", "rejected", "expired".
approvedBystring❌Name of the person who approved the license. Defaults to the source player.
approvedDatestring❌Date of approval in format "YYYY-MM-DD HH:MM:SS". Defaults to current date.
expirationDatestring❌Expiry date in format "YYYY-MM-DD HH:MM:SS". Set only if status is "approved".
notestring❌Additional notes or comments related to the license.

Returns

Type: table
Description: Returns a response object indicating the result of the operation.


Response Fields

FieldTypeDescription
successbooleanWhether the license was successfully inserted or updated.
messagestringA message describing the outcome (e.g., "License updated successfully.").
licensesstring(Optional) JSON-encoded string of all licenses associated with the citizen.

Example Usage

local result = exports['kartik-mdt']:updateCitizenLicense(source, {
    citizenId = "CIT12345",
    license = {
        type = "driver",
        name = "Driver License",
        status = "approved",
        approvedBy = "Officer Smith",
        approvedDate = "2025-04-16 14:25:00",
        expirationDate = "2026-04-16 00:00:00",
        note = "First-time issue"
    }
})

On this page