JCKS Lib Referencia
API reference
Every client and server export of jcks_lib, the UI global and the events other resources can listen to.
Every function is a plain export, so exports.jcks_lib:Notify({...}) works without any import. With shared_script '@jcks_lib/import.lua' in your manifest you get a global UI table that forwards to the same exports: UI.Notify({...}).
Functions that wait for the player (Progress, Input, Alert, Confirm, Prompt, SkillCheck, Request) must run inside a thread: CreateThread, a command handler, an onSelect callback and similar.
Options of each function are described in UI components , Panels , Interactions and Themes .
Server exports #
Export
Returns
What it does
Notify(target, data)
boolean
Sends a notification to a player. target is a server id or -1 for everyone. false for an invalid target.
Banner(target, data)
boolean
Shows a banner on a player's screen, same targets as Notify
GetAppearance()
table?
The appearance block of the bridge setup from GlobalState['jcks:setup']
ApplyVehicleProps(entity, props)
boolean
Puts vehicle props into the entity state bag jcks:props. The client that owns the vehicle applies them and reports back, then the server clears the bag. false when props is not a table or the entity does not exist.
IsStandalone()
boolean
true while jcks_bridge does not run and /uiadmin holds the settings
GetStandaloneSettings()
table
A copy of everything saved in /uiadmin
lua Copy exports. jcks_lib : Notify (source, { title = 'Garage' , description = 'Vehicle stored' , type = 'success' })
exports. jcks_lib : Banner ( - 1 , { title = 'Restart in 10 minutes' , icon = 'clock' })
local vehicle = CreateVehicleServerSetter (model, 'automobile' , x, y, z, heading)
exports. jcks_lib : ApplyVehicleProps (vehicle, props)
Client exports #
Notifications and text UI #
Export
What it does
Notify(data)
Shows a notification
DismissNotify(id?)
Removes the notification with this id, or all without an id
OpenNotificationCenter() / CloseNotificationCenter()
History of this session's notifications
ShowTextUI(text, opts?) / HideTextUI()
Text prompt. The same call with the same text does nothing, so it is safe every tick.
IsTextUIOpen()
open, text
Progress and skill check #
Export
What it does
Progress(opts)
Blocking progress. true when finished, false when cancelled.
ProgressBar(opts) / ProgressCircle(opts)
Same with a forced style
CancelProgress() / IsProgressActive()
SkillCheck(difficulty, inputs?)
true on success
CancelSkillCheck() / IsSkillCheckActive()
Menus and dialogs #
Export
What it does
RegisterContext(def) / ShowContext(id)
Context menu registered by id
Context(def) / OpenContext(def)
One-off context menu without an id
HideContext(runOnExit?) / GetOpenContextMenu()
Input(title, rows, opts?) / InputDialog(...)
Input dialog. Returns a list of values or nil when cancelled.
Alert(data) / AlertDialog(data)
Returns 'confirm' or 'cancel'
Confirm(title, text, opts?)
Returns true or false
Prompt(title, label, opts?)
Returns the text or nil
CloseInputDialog() / CloseAlertDialog()
RegisterMenu(def, onSelected?) / ShowMenu(id, startIndex?) / HideMenu(runOnClose?)
Keyboard list menu
GetOpenMenu() / SetMenuOptions(id, option, index)
AddRadialItem(items) / RemoveRadialItem(id) / ClearRadialItems()
Radial items. ClearRadialItems only removes the items of the calling resource.
RegisterRadial(def) / HideRadial() / DisableRadial(state) / GetCurrentRadialId()
Requests, Spotlight and HUD #
Export
What it does
Request(data) / CancelRequest()
Y and N prompt without the mouse. Returns true, false or nil when it timed out.
RegisterAction(def) / RemoveAction(id)
Spotlight quick action
OpenSpotlight() / CloseSpotlight()
ShowHints(id, keys, opts?) / HideHints(id?)
Several key hints at once. HideHints() without an id removes all.
SetOverlayInsets({ hintsBottom })
Moves the key hints up, hintsBottom in percent of the screen height (up to 70). Reset when the calling resource stops.
SetObjectives(id, def) / UpdateObjective(id, index, patch) / ClearObjectives(id)
Task tracker
Timer(id, def) / StopTimer(id)
Countdown or stopwatch chip
Banner(data)
Large announcement card
PlacementHud(def or false) / UpdatePlacementHud(state)
Placement panel for NPCs, vehicles, props and points
SetClipboard(text)
Copies text to the player's clipboard
Panels #
Export
What it does
RegisterPanel(def) / OpenPanel(def or id, pageId?) / Panel(def)
Opens or registers a panel
ClosePanel() / GetOpenPanel()
GetOpenPanel returns panelId, pageId
ShowPanelPage(pageId) / SetPanelPage(panelId, pageId, page)
Navigate or replace a page
UpdatePanel(panelId, elementId, patch)
Live patch of a block or item by id
SetPanelNav(panelId, nav, footer?) / UpdatePanelNav(panelId, navId, patch)
Sidebar items and badges
Interactions #
Export
What it does
AddInteraction(def)
Adds an interaction owned by the calling resource and returns its id
RemoveInteraction(id) / HasInteraction(id)
Appearance and player settings #
Export
Returns
What it does
GetAppearance(resource?)
{ script, surfaces, theme, themes, playerThemes, motion, scale, branding, logoUrl }
Look for the calling resource, or for the named one
GetSettings(resource?)
{ locale, appearance, sounds, notifyPosition, textPosition, progressStyle }
Everything a JCKS window needs on start, appearance as above
GetPlayerPreferences()
{ theme, scriptThemes, themes, locale, scale, motion, sounds }
Only fields the server allows
GetPlayerPolicy()
{ enabled, theme, customize, import, locale, scale, sounds }
What the player may change
SetPlayerPreferences(prefs) / ResetPlayerPreferences()
GetPlayerLook()
table
The server look without player choices: default theme, server themes, scale, motion, language
OpenPlayerSettings() / ClosePlayerSettings()
The /uisettings window
OpenThemeMarket()
The theme presets browser (JCKS Presets), also in Spotlight
GetCache()
table
The values behind jcks.cache (playerId, serverId, ped, vehicle, seat, weapon)
Events #
Event
Side
Arguments
When
jcks_lib:preferencesChanged
client
prefs
The player changed their UI settings
jcks_lib:focusReleased
client
/jcksfocus released the NUI focus
jcks_lib:cache
client
key, value, old
A jcks.cache value changed
jcks_lib:callbackRefused
server
resource, name, source, reason
A jcks.callback call was refused. jcks_logs listens to it.
jcks_lib:netRefused
server
resource, name, source, reason
A jcks.net.on event was refused (rate_limit, invalid_arguments, job, permission, distance)
jcks_lib:standaloneChanged
server
on
jcks_lib switched between running alone (/uiadmin) and following jcks_bridge
lua Copy AddEventHandler ( 'jcks_lib:preferencesChanged' , function (prefs)
print (prefs. locale , prefs. theme )
end )
Coming from ox_lib #
ox_lib
jcks_lib
lib.notify
UI.Notify
lib.showTextUI / hideTextUI
UI.ShowTextUI / UI.HideTextUI
lib.progressBar / progressCircle
UI.ProgressBar / UI.ProgressCircle / UI.Progress
lib.registerContext / showContext
UI.RegisterContext / UI.ShowContext, or UI.Context({...}) inline
lib.inputDialog
UI.Input
lib.alertDialog
UI.Alert, plus UI.Confirm and UI.Prompt
lib.registerMenu / showMenu
UI.RegisterMenu / UI.ShowMenu
lib.addRadialItem / registerRadial
UI.AddRadialItem / UI.RegisterRadial
lib.skillCheck
UI.SkillCheck
lib.callback
jcks.callback, see Core modules
lib.points, lib.zones
jcks.points, jcks.zones
none
UI.OpenPanel, UI.Request, UI.RegisterAction, UI.ShowHints, UI.SetObjectives, UI.Timer, UI.Banner