STG ScriptsDocumentation
MDT + CAD System

Integrations

Connect STG MDT to your own phone, inventory, billing or garage script through the editable integrations folder, and create MDT calls from other scripts.

Everything that talks to another script lives in stg-mdt/integrations/. These files stay editable in the escrow version, so you can connect any phone, inventory, billing or garage script without touching the rest of the MDT. Restart the resource after a change.

FileSideWhat it controls
client.luaClientNotifications, hiding your HUD, fuel level and when the MDT may open
phones.luaServerWhich phone scripts the phone trace reads
inventory.luaServerThe evidence locker and the blood sample item
billing.luaServerBilling modes for EMS bills and police citations
garage.luaServerWhat impounding a vehicle does

Client

Config.Functions = {
    CustomNotify = false,
    Notify = function(type, message) ... end,
    CanOpen = function() ... end,
    HideHud = function() ... end,
    ShowHud = function() ... end,
    GetFuel = function(vehicle) ... end,
}

Prop

Type

Phones

The phone trace supports npwd, lb-phone, qs-smartphone, gksphone and qb-phone. With Config.PhoneTrace.Phone = 'auto' the first one that is running and has its database tables is used.

Every phone is one entry in Config.PhoneTrace.Providers. To add another phone, copy an entry and change the queries to match its tables:

{
    Name = 'my-phone',
    Resource = 'my-phone',
    Tables = {
        my_phone_calls = { 'caller', 'callee', 'answered', 'time' },
    },
    Owner = 'SELECT citizenid AS identifier FROM players WHERE phone_number = @number LIMIT 1',
    Calls = 'SELECT caller, callee, answered, UNIX_TIMESTAMP(time) AS time, 0 AS duration FROM my_phone_calls WHERE caller = @number OR callee = @number ORDER BY time DESC LIMIT 40',
    Messages = 'SELECT sender, receiver AS peer, message AS body, UNIX_TIMESTAMP(time) AS time FROM my_phone_messages WHERE (sender = @number OR receiver = @number) AND time >= FROM_UNIXTIME(@since) ORDER BY time DESC LIMIT 300',
},
QueryColumns it must return
Owneridentifier
Callscaller, callee, answered (0 or 1), time (unix), duration (seconds)
Messagessender, peer, body, time (unix)

@number is the traced number and @since the oldest message time. Tables lists the tables and columns that must exist, so a phone is skipped when your database does not match. The server console prints which phone the trace uses on start.

Inventory

function Inventory.openStash(source, id, label, slots, weight, jobs) ... end
function Inventory.addItem(source, item, metadata) ... end
function Inventory.takeTagged(source, item, key) ... end

Prop

Type

ox_inventory and qb-inventory work out of the box. For another inventory, call its stash and item exports inside these functions. Items put in a locker are logged as evidence automatically with ox_inventory.

Billing

BillingModes = {
    esx_billing = function(bill) ... end,
    custom = function(bill)
        -- exports['your_billing']:CreateInvoice(bill.target, bill.amount, bill.reason, bill.issuer)
    end,
}

consent and log are built in. Every other Config.Billing.Mode is a function in this table. Add your billing script as a new entry, then set Config.Billing.Mode to its name.

Prop

Type

Garage

function ImpoundVehicle(plate, price) ... end

By default an impounded vehicle is marked in player_vehicles (QBCore, QBOX) or owned_vehicles (ESX). If your garage script keeps its own impound, call its export here instead.

Creating calls from other scripts

Robberies, alarms or any other script can put a call on the MDT from the server side:

local id = exports['stg-mdt']:createCall({
    department = 'police',
    code = '10-31',
    title = 'Store robbery',
    description = 'Silent alarm at the 24/7 on Innocence Blvd',
    caller = 'Alarm system',
    location = 'Innocence Blvd',
    coords = vec3(25.7, -1347.3, 29.5),
    priority = true,
})

Prop

Type

ExportWhat it does
createCall(data)Creates a call and returns its id
closeCall(id)Closes the call
attachCall(id, source)Attaches an on duty unit to the call
removeCall(id)Removes the call from the board

Next steps

Still having trouble?

Open a ticket on our Discord. Our team answers around 15 hours a day.

Get help on Discord

On this page