Skip to main content
This page gives you a practical overview of what TS-Lib exposes at runtime once you include @ts-lib/import.lua in your resource.

Core utilities

TS-Lib attaches a few helpers to a global TS table that are reused across Toine Scripts.

Logging

  • TS.Print(message, resourceName?)
  • TS.DebugPrint(message, resourceName?)
  • TS.ErrorPrint(message, resourceName?)
  • TS.SuccessPrint(message, resourceName?)
TS.DebugPrint('My script has started', GetCurrentResourceName())

Generic utils

Common helpers include:
  • TS.Utils.IsRessourceLoaded(resourceName): boolean
  • TS.Utils.IsTableEmpty(tbl): boolean
if not TS.Utils.IsRessourceLoaded('qb-core') then
    TS.ErrorPrint('qb-core is missing, TS-Lib bridges will not work correctly')
end

Intervals

TS-Lib embeds an interval helper to simplify repeating callbacks:
  • TS.Intervals.Set(callback, ms, ...): id
  • TS.Intervals.Clear(id)
local id = TS.Intervals.Set(function()
    TS.DebugPrint('Still alive')
end, 5000)

-- later
TS.Intervals.Clear(id)

UI helpers

TS-Lib also exposes small, framework-agnostic UI helpers through TS.Lib.*.
These are rendered via the bundled NUI (ui/build).

Subtitle

  • TS.Lib.Subtitle.Show(text: string)
  • TS.Lib.Subtitle.Hide()
From a client script that has included @ts-lib/import.lua:
TS.Lib.Subtitle.Show('Press E to interact')

-- later
TS.Lib.Subtitle.Hide()
From another resource using exports only:
exports['ts-lib']:SendSubtitle('Press E to interact')

-- later
exports['ts-lib']:HideSubtitle()

Text UI (help text)

  • TS.Lib.TextUI.Show(text: string, position?: string)
  • TS.Lib.TextUI.Hide()
position defaults to 'top-left'. Common positions used by the UI are:
  • top-left
  • top-center
Example from a client script:
TS.Lib.TextUI.Show('Press E to open garage', 'top-center')

-- later
TS.Lib.TextUI.Hide()
Or via exports:
exports['ts-lib']:SendTextUI('Press E to open garage', 'top-center')

-- later
exports['ts-lib']:HideTextUI()

Bridges overview

The main reason to use TS-Lib is its bridge modules. They expose normalized APIs that hide framework-specific or script-specific details.
  • Bridge.Framework.* → talks to your framework (QBCore / ESX / QBox / standalone)
  • Bridge.Garages.* → talks to your garage script
  • Bridge.VehicleKeys.* → talks to your vehicle keys script
Each bridge has its own dedicated page with full details: Below are the patterns you will most often use from a script that depends on TS-Lib.

Framework bridge (quick reference)

Client

  • Bridge.Framework.Client.PlayerData
    Unified player data, automatically updated when the player loads / unloads / changes job.
  • Bridge.Framework.Client.Functions.GetPlayerJob() -> ok, jobOrError
local ok, job = Bridge.Framework.Client.Functions.GetPlayerJob()
if ok then
    print(('Job: %s (%s)'):format(job.name, job.label))
end

Server

  • Bridge.Framework.Server.Functions.GetPlayerJob(source)
  • Bridge.Framework.Server.Functions.GetPlayersByJobName(jobName, checkOnDuty?)
  • Bridge.Framework.Server.Functions.GetPlayers()
  • Bridge.Framework.Server.Functions.GetVehicleType(model)
See Framework Bridge for framework-specific notes and event names.

Garage bridge (quick reference)

Server

  • Bridge.Garages.Server.Functions.IsVehicleOwned(plate, netId?) -> boolean
  • Bridge.Garages.Server.Functions.SetVehicleOutsideState(plate, state)
local owned = Bridge.Garages.Server.Functions.IsVehicleOwned(plate, netId)
if not owned then return end

-- mark the vehicle as outside
Bridge.Garages.Server.Functions.SetVehicleOutsideState(plate, true)
See Garage Bridges for the exact behavior per system.

Vehicle keys bridge (quick reference)

The keys bridge focuses on locking / unlocking vehicles from a unified entrypoint.

Client

  • Bridge.VehicleKeys.Client.Functions.SetDoorStatus(entity, lockStatus)
-- Example: lock a vehicle from another script
Bridge.VehicleKeys.Client.Functions.SetDoorStatus(vehicle, 2) -- 2 = locked
Lock states follow GTA’s native semantics (1 = unlocked, 2 = locked, 4 = locked for all players, etc.). See Vehicle Keys Bridges for system-specific behavior (qb-vehiclekeys, qs-vehiclekeys, standalone).
Last modified on March 13, 2026