~/vipex/docs_

Exports

Server-side export API reference for vx_mdt.

All exports are server-side only. Failed calls return { error = "..." }.

Exports are controlled by the exportAllowlist in config — an empty table allows all resources to call them.

Officers

createOfficer(identifier, depId, data)

Create a staff record for a department.

---@param identifier string Citizen/state ID
---@param depId number Department ID
---@param data { first_name: string, last_name: string, callsign?: string, badge_number?: string, rank_id?: number, source?: number }
---@return table Staff record or { error: string }
local officer = exports.vx_mdt:createOfficer(identifier, depId, {
    first_name = "John",
    last_name = "Doe",
    callsign = "1-A",
    badge_number = "1234",
})

deleteOfficer(identifier, depId)

Soft-delete an officer (sets status to "terminated").

---@param identifier string Citizen/state ID
---@param depId number Department ID
---@return boolean
local success = exports.vx_mdt:deleteOfficer(identifier, depId)

getOfficer(identifier, depId)

Get officer data including permissions.

---@param identifier string Citizen/state ID
---@param depId number Department ID
---@return table|nil Staff record or nil
local officer = exports.vx_mdt:getOfficer(identifier, depId)

updateOfficer(identifier, depId, data)

Update officer fields.

---@param identifier string Citizen/state ID
---@param depId number Department ID
---@param data { callsign?: string, badge_number?: string, rank_id?: number, status?: string, notes?: string, certificates?: table }
---@return boolean
local success = exports.vx_mdt:updateOfficer(identifier, depId, {
    callsign = "2-B",
    badge_number = "5678",
})

isOfficer(source)

Check if an online player is set up as an officer.

---@param source number Player server ID
---@return boolean
local isOfficer = exports.vx_mdt:isOfficer(source)

getOfficerBySource(source)

Get officer data for an online player.

---@param source number Player server ID
---@return table|nil Staff record or nil
local officer = exports.vx_mdt:getOfficerBySource(source)

Profiles

getProfile(identifier)

Get a full citizen profile.

---@param identifier string Citizen/state ID
---@return table|nil Profile record or nil
local profile = exports.vx_mdt:getProfile(identifier)

updateProfileField(identifier, field, value)

Update a specific field on a citizen profile.

---@param identifier string Citizen/state ID
---@param field "dna"|"fingerprint"|"bloodtype"|"profile_image_url"
---@param value string New value
---@return boolean
local success = exports.vx_mdt:updateProfileField(identifier, "dna", "ABC-1234")

searchProfiles(query)

Search citizen profiles by name or identifier.

---@param query string Search query
---@return table[] Array of profile search results
local results = exports.vx_mdt:searchProfiles("John")

Vehicles

getVehicle(plate)

Get a full vehicle record by plate.

---@param plate string Vehicle plate
---@return table|nil Vehicle record or nil
local vehicle = exports.vx_mdt:getVehicle("ABC123")

setVehicleStatus(plate, status, notes?)

Set the status flag on a vehicle. When notes is provided, it overwrites the vehicle's notes field; when omitted, existing notes are preserved.

---@param plate string Vehicle plate
---@param status "none"|"stolen"|"seized"|"impounded"|"wanted"|"flagged"|"parked"|"out"
---@param notes? string Optional notes to set on the vehicle
---@return boolean
local success = exports.vx_mdt:setVehicleStatus("ABC123", "stolen")
local success = exports.vx_mdt:setVehicleStatus("ABC123", "parked", "Garage: Legion Square")

searchVehicles(query)

Search vehicles by plate or owner.

---@param query string Search query
---@return table[] Array of vehicle search results
local results = exports.vx_mdt:searchVehicles("ABC")

registerVehicle(source, data)

Fire-and-forget auto-register from garage bridges.

---@param source number Player server ID
---@param data { plate: string, model_name?: string, color?: string, vehicle_class?: string, autoLinkOwner?: boolean, owner?: string }
exports.vx_mdt:registerVehicle(source, {
    plate = "ABC123",
    model_name = "sultan",
    color = "Red",
})

Weapons

createWeapon(serial, data)

Create a weapon record if it doesn't already exist.

---@param serial string Weapon serial number
---@param data { model?: string, owner?: string, source?: number }
---@return boolean
local success = exports.vx_mdt:createWeapon("WPN-001", {
    model = "WEAPON_PISTOL",
    owner = "ABC12345",
})

getWeapon(serial)

Get a full weapon record by serial number.

---@param serial string Weapon serial number
---@return table|nil Weapon record or nil
local weapon = exports.vx_mdt:getWeapon("WPN-001")

setWeaponStatus(serial, status)

Set the status flag on a weapon.

---@param serial string Weapon serial number
---@param status "none"|"stolen"|"seized"|"destroyed"|"missing"
---@return boolean
local success = exports.vx_mdt:setWeaponStatus("WPN-001", "stolen")

registerWeapon(source, data)

Fire-and-forget auto-register from inventory bridges.

---@param source number Player server ID
---@param data { serial: string, model?: string, owner?: string }
exports.vx_mdt:registerWeapon(source, {
    serial = "WPN-001",
    model = "WEAPON_PISTOL",
})

Properties

getProperty(id)

Get a property record by ID.

---@param id number Property ID
---@return table|nil Property record or nil
local property = exports.vx_mdt:getProperty(1)

searchProperties(query)

Search properties by address.

---@param query string Search query
---@return table[] Array of property search results
local results = exports.vx_mdt:searchProperties("Alta St")

BOLOs

createBolo(depId, data)

Create a Be On the Lookout notice.

---@param depId number Department ID
---@param data { title: string, bolo_type?: "person"|"vehicle"|"other", author?: string }
---@return { id: number }|{ error: string }
local result = exports.vx_mdt:createBolo(1, {
    title = "Suspect in white sedan",
    bolo_type = "vehicle",
    author = "Officer Smith",
})

deleteBolo(boloId, depId)

Delete a BOLO by ID.

---@param boloId number BOLO ID
---@param depId number Department ID
---@return {}|{ error: string }
local result = exports.vx_mdt:deleteBolo(1, 1)

hasActiveBolo(identifier)

Check if an identifier has any active BOLOs. Uses in-memory lookup for fast performance.

---@param identifier string Citizen/state ID
---@return boolean
local hasBolo = exports.vx_mdt:hasActiveBolo(identifier)

Warrants

createWarrant(depId, data)

Create a warrant.

---@param depId number Department ID
---@param data { title: string, warrant_type?: "arrest"|"search", author?: string }
---@return { id: number }|{ error: string }
local result = exports.vx_mdt:createWarrant(1, {
    title = "Arrest warrant for John Doe",
    warrant_type = "arrest",
    author = "Judge Williams",
})

deleteWarrant(warrantId, depId)

Delete a warrant by ID.

---@param warrantId number Warrant ID
---@param depId number Department ID
---@return {}|{ error: string }
local result = exports.vx_mdt:deleteWarrant(1, 1)

hasActiveWarrant(identifier)

Check if an identifier has any active warrants. Uses in-memory lookup for fast performance.

---@param identifier string Citizen/state ID
---@return boolean
local hasWarrant = exports.vx_mdt:hasActiveWarrant(identifier)

Incidents

createIncident(depId, data)

Create a new incident.

---@param depId number Department ID
---@param data { title: string, author?: string, dep_type?: "law"|"ems"|"judge" }
---@return { id: number }|{ error: string }
local result = exports.vx_mdt:createIncident(1, {
    title = "Traffic stop on Route 68",
    author = "Officer Smith",
})

Reports

createReport(depId, data)

Create a new report.

---@param depId number Department ID
---@param data { title: string, author?: string, dep_type?: "law"|"ems"|"judge" }
---@return { id: number }|{ error: string }
local result = exports.vx_mdt:createReport(1, {
    title = "Daily patrol report",
    author = "Officer Smith",
})

Toaster

toastPlayer(source, data)

Send a toast notification to a single player.

---@param source number Player server ID
---@param data { title: string, message: string, close_delay?: number, type?: "default"|"assertive"|"polite"|"warn", sound?: string }
---@return boolean|{ error: string }
local result = exports.vx_mdt:toastPlayer(source, {
    title = "Dispatch",
    message = "You have been assigned to call #42",
})

toastPlayers(sources, data)

Send a toast notification to multiple players.

---@param sources number[] Array of player server IDs
---@param data { title: string, message: string, close_delay?: number, type?: "default"|"assertive"|"polite"|"warn", sound?: string }
---@return boolean|{ error: string }
local result = exports.vx_mdt:toastPlayers({1, 2, 3}, {
    title = "Alert",
    message = "Shift change in 5 minutes",
})

toastDepartment(depId, data, excludeSource?)

Send a toast notification to all online members of a department.

---@param depId number Department ID
---@param data { title: string, message: string, close_delay?: number, type?: "default"|"assertive"|"polite"|"warn", sound?: string }
---@param excludeSource? number Player server ID to exclude
---@return boolean|{ error: string }
local result = exports.vx_mdt:toastDepartment(1, {
    title = "BOLO Update",
    message = "New BOLO issued for white sedan",
})

Lookups

getCharges()

Returns all charges with categories (cached).

---@return table[] Array of charges
local charges = exports.vx_mdt:getCharges()

getDepartments()

Returns a lightweight department list.

---@return table[] Array of departments
local departments = exports.vx_mdt:getDepartments()

On this page