AI Core

MDT

Open the police MDT for the local player, whatever MDT the server runs.

The MDT (mobile data terminal) is the police computer: records, warrants, reports. ai-core's MDT layer opens the one the server runs, so a radial item, a key or a vehicle laptop in your script opens the right screen. Supported MDTs that can be opened from another script: tgiann-mdt, ps-mdt, wasabi_mdt.

OpenMdt

Opens the active MDT's screen for the local player. The MDT checks the player's job itself and refuses a player who may not use it.

Side: Client · Waits: no

Signature
OpenMdt(): boolean
Lua
local opened = exports['ai-core']:OpenMdt() -- or aiLib.mdt.open()

Parameters

None.

Returns

boolean: true when the active MDT was asked to open. false when no supported MDT runs, or the running one cannot be opened from another script. true does not mean the screen showed: the MDT may still refuse the player's job.

Example

resource/client/laptop.ts
import { cache, getPlayerData, mdt, notify, radial } from "@aicore-fivem/lib/client";
import { RADIAL_VEHICLE } from "@aicore-fivem/shared";
import { Locale } from "common";

// A laptop entry in the vehicle sub menu for on-duty police.
radial.add({
  id: "myscript_mdt",
  label: Locale("RADIAL_MDT"),
  icon: "laptop",
  parent: RADIAL_VEHICLE,
  canShow: () => cache.vehicle !== false && getPlayerData("duty") === "police",
  onPressed: () => {
    if (!mdt.open()) notify(Locale("NO_MDT"), "error");
  },
});

On this page