UI Client
A module to manage UI elements from the game.
JO Functions
jo.ui.finishTimer()
Terminates the Timer's UI and destroys associated resources
Syntax
jo.ui.finishTimer()
Example
-- Initialize and start a timer
jo.ui.initTimer()
jo.ui.startTimer(30) -- 30 seconds timer
-- Later, when completely done with the timer and want to clean up resources
jo.ui.finishTimer()
jo.ui.initTimer()
Initializes the timer's UI
Syntax
jo.ui.initTimer()
Return Value
Type : number
The state machine identifier
Example
-- Initialize the timer UI before using it
local stateMachine = jo.ui.initTimer()
-- Check if initialization was successful
if stateMachine then
print("Timer UI successfully initialized")
-- Now we can use startTimer, stopTimer or other timer functions
end
jo.ui.startTimer()
Starts the timer's UI

Syntax
jo.ui.startTimer(time, low)
Parameters
time
: integer
The time in seconds for the timer
low
: integer Optional
The threshold in seconds at which the timer color will turn red
Example
local time = 60 -- 1 minute
local low = 10 -- Turn red at 10 seconds
jo.ui.initTimer()
jo.ui.startTimer(time, low)
jo.ui.stopTimer()
Stops the Timer's UI before it finishes naturally
Syntax
jo.ui.stopTimer()
Example
-- Initialize and start a 2-minute timer
jo.ui.initTimer()
jo.ui.startTimer(120)
-- Later, when you need to stop the timer (e.g., when a mission is completed early)
Citizen.CreateThread(function()
Citizen.Wait(30000) -- Wait 30 seconds
jo.ui.stopTimer() -- Stop the timer before it naturally finishes
print("Timer stopped early")
end)
jo.ui.updateRank()
Updates the rank element on the top left of weapon wheel

Syntax
jo.ui.updateRank(level, xp, xpRequired)
Parameters
level
: integer
The level printed in the left of the element
xp
: integer
The current xp amount
xpRequired
: integer
The amount of XP required to level up
Example
local level = 325
local xp = 215
local xpRequired = 17400
jo.ui.updateRank(level, xp, xpRequired)
Internal Variables and Structures
The Timer UI system uses the following internal variables and structures, which should not be modified directly:
jo.ui.TimerUI.data.uiFlowblock
- Reference to the UI flowblock componentjo.ui.TimerUI.data.container
- Reference to the databinding containerjo.ui.TimerUI.data.timer
- Reference to the timer's databinding entryjo.ui.TimerUI.data.show
- Reference to the visibility databinding entryjo.ui.TimerUI.data.stateMachine
- Identifier for the UI state machinejo.ui.TimerUI.data.time
- Current timer value in seconds
These variables are essential for the proper functioning and state management of the Timer UI system. Modifying them directly may cause unexpected behavior.