TC ScriptDocumentation

Lua API

Every function of the tc global: notifications, progress, mini-games, keypad, HUD, dialogs, interaction points.

All functions below are client-side unless stated otherwise. Each one also exists as an export: exports['tc-ui']:name(...).

#Notifications

Lua
tc.notify({ title = 'Title', description = 'Text', type = 'success', icon = nil, duration = 4000, position = nil })
FieldRole
title, descriptionDisplayed texts
typesuccess, error, warning or info
iconIcon (optional)
durationDisplay time
positionScreen position (optional)

Server-side: tc.notify(source, data) (use -1 for everyone).

server.lua
tc.notify(source, { title = 'Bank', description = 'Transfer received.', type = 'success' })
tc.notify(-1, { title = 'Announcement', description = 'Restart in 10 minutes.', type = 'warning' })

#Progress bar

Lua
local ok = tc.progress('Repairing the engine', 8000, {
    canCancel = true,
    hint = 'Press X to cancel',
    disable = { move = true, sprint = true, combat = true, car = true },
    anim = { dict = 'mini@repair', clip = 'fixing_a_ped', flag = 49 },
    check = function() return not IsPedInAnyVehicle(PlayerPedId(), false) end,
})
if ok then print('Done') else print('Cancelled') end

tc.progress(label, duration, opts) is blocking and returns true (finished) or false (cancelled).

OptionRole
canCancelAllows cancelling with X (default true)
hintHelp text under the bar
disable{ move, sprint, jump, vehicle, combat, car, mouse, controls = { ids } } or false to block nothing
anim{ dict, clip, flag } or { scenario = '...' }
checkFunction called every frame: returning false cancels the bar

#Script-driven bar

Lua
tc.progressManual('Loading', 0.0, 'Please wait…')
tc.progressManual('Loading', 0.5)    -- pct from 0 to 1
tc.progressEnd()

Others: tc.progressActive() (state), tc.cancelProgress() (cancel).

#Mini-games

Lua
-- keyboard
local ok = tc.minigame('precision', { hits = 3 }, 3, 'Lockpicking')
local ok2 = tc.minigame({ kind = 'sequence', preset = { sequence = 5 }, maxFails = 2, label = 'Code', timeout = 20000 })

tc.minigame(kind, preset, maxFails, label) returns true on success. preset is a table of settings (omitted values use their default, see the table). With the table form, timeout (in ms, 90,000 by default) stops the mini-game: the result is then false.

kindControlpreset settings (default)
precisionKeyboard (Space)zone: zone width, 0.06 to 0.5 (0.18) · speed: cursor speed, min. 0.3 (1) · hits: hits required (3)
sequenceKeyboardsequence: length 3 to 8 (5) · sequenceTime: time in ms, min. 2000 (5500) · keys: keys used (W A S D Q E)
wires, button, braille, symbols, switches, password, soundMouse (bomb modules)time: timer in seconds (90 for button) · count: 3 to 6 wires for wires · rules = false to hide the rules

maxFails (3 by default, at least 1) is the number of tolerated mistakes.

For bomb modules, the rules are shown next to the module and a mistake costs a life. tc.minigameActive() tells whether a mini-game is running.

#Keypad

Lua
local code = tc.keypad({
    label = 'Safe', subtitle = 'Enter the code', badge = 'PIN',
    length = 4, min = 4, max = 8, lockedFor = 0,
    validate = function(code)
        local ok = lib.callback.await('myscript:check', false, code)
        if ok then return true end
        return false, 'Wrong code', 30      -- message + 30 s lock
    end,
})

Returns the entered code, or nil if cancelled. validate is optional and may query the server: as long as it returns a falsy value, the keypad stays open and shows the error. It can return true, false, message, seconds, or a table { ok, err, lockedFor }.

Lua
local accepted = tc.consent({ title = 'Sampling', text = 'Accept?', subtitle = 'Police', timeout = 20,
    labels = { accept = 'Accept', refuse = 'Refuse' } })

Returns true / false; no answer within the delay means false.

#Help HUD, crosshair, hints

Lua
tc.showHud({ title = 'Workshop', text = 'Fit the part', keys = { { key = 'E', label = 'Fit' }, { key = 'X', label = 'Cancel' } }, header = nil, icon = nil, position = nil })
tc.hideHud()

tc.helpText('~INPUT_CONTEXT~ Open  ~INPUT_RELOAD~ Rotate')   -- native help, call it EVERY frame

tc.crosshair(true, 'BLOCKED', nil)    -- central crosshair; 'BLOCKED' = alert colour
tc.worldHint({ key = 'E', label = 'Open', sub = 'Chest', coords = vec3(0, 0, 0) })   -- hint anchored in the world
tc.hideWorldHint()
  • tc.isHudOpen() tells whether the HUD is shown.
  • tc.worldHint with coords follows the point in the world; otherwise give x, y (0 to 1) and use tc.worldHintPos(x, y). variant = 'uv' gives the purple version.
  • tc.helpText translates ~INPUT_…~ codes into key names.

#Dialogs

Lua
local choice = tc.alert({ header = 'Delete?', content = 'This is permanent.', subtitle = nil, labels = { confirm = 'Yes', cancel = 'No' }, cancel = true, danger = true })
-- 'confirm' or 'cancel'

local answer = tc.input('New vehicle', {
    { type = 'input',    label = 'Name' },
    { type = 'number',   label = 'Price' },
    { type = 'select',   label = 'Category', options = { { value = 'a', label = 'A' }, { value = 'b', label = 'B' } } },
    { type = 'checkbox', label = 'Active' },
})
-- table of answers, or nil if cancelled

Field types: input, number, textarea, select, checkbox, slider, color. tc.closeDialog() closes the current dialog.

#Interaction points

A “key + text” prompt anchored in the world, without a target system:

Lua
tc.point.add('workshop:chest', {
    coords = vec3(0.0, 0.0, 70.0), radius = 2.0, key = 'E', label = 'Open the chest',
    canInteract = function() return true end,
    onPress = function() print('opened') end,
    marker = false,
})
tc.point.update('workshop:chest', { label = 'Other text' })
tc.point.remove('workshop:chest')
tc.point.clear()

Equivalent exports: addPoint, updatePoint, removePoint, clearPoints.

#Exports list

CategoryExports
Notificationsnotify
Progressprogress, progressManual, progressEnd, progressActive, cancelProgress
Mini-gamesminigame (alias skillCheck), minigameActive
Keypadkeypad, closeKeypad
Consentconsent, closeConsent
HUD / helpshowHud, hideHud, isHudOpen, helpText, crosshair
HintsworldHint, worldHintPos, hideWorldHint
Dialogsalert, input, closeDialog
PointsaddPoint, updatePoint, removePoint, clearPoints
Servernotify
Last updated : 7 November 2026© 2026 TC Script