🔧 Misc
AirplaneModeEnabled
lua---@return boolean exports.yseries:AirplaneModeEnabled()
StreamerModeEnabled
lua---@return boolean exports.yseries:StreamerModeEnabled()
UpdateStreamerMode
lua---@param enabled boolean on/off the phone's steamer mode ---@param updateUI boolean whether to send an update to the UI to update the settings exports.yseries:UpdateStreamerMode(enabled, updateUI)
ToggleFlashlight
lua---@param enabled boolean on/off the phone's flashlight exports.yseries:ToggleFlashlight(enabled)
GetFlashlightState
lua---@return boolean exports.yseries:GetFlashlightState()
SendAppMessage
lua---@param appId string -- Custom app key ---@param data { action: string, data: table } -- Data to send to the app exports.yseries:SendAppMessage(appId, data) --- Example exports.yseries:SendAppMessage('app-id', { action = 'action-name', data = { foo = 'bar' } })
ToggleLandscape
lua-- Toggle current landscape state exports['yseries']:ToggleLandscape() -- Set to landscape mode explicitly exports['yseries']:ToggleLandscape(true) -- Set to portrait mode explicitly exports['yseries']:ToggleLandscape(false)
IsAppInstalled
Check if an app is installed on the current phone. You can refer to config/config.json for the app keys.
lua---@param appKey string The app key to check (e.g., 'darkchat', 'banking') ---@return boolean True if the app is installed, false otherwise exports.yseries:IsAppInstalled(appKey) -- Example local isDarkChatInstalled = exports.yseries:IsAppInstalled('darkchat') if isDarkChatInstalled then print('DarkChat is installed on this phone') end
GetCurrentAppId
Returns the ID of the currently opened app, or checks if a specific app is open.
Without arguments: Returns the current app ID (e.g. 'messages', 'home', 'banking', or custom app key). Returns nil when the phone is closed.
With appId argument: Returns true if that app is currently open, false otherwise.
lua---@param appId string|nil Optional. If provided, returns true/false. If nil, returns current app id. ---@return string|boolean|nil Current app id, or true if appId matches, or nil when phone closed / no app exports.yseries:GetCurrentAppId(appId) -- Example: Get current app local appId = exports.yseries:GetCurrentAppId() if appId then print('Current app: ' .. appId) end -- Example: Check if specific app is open local isMessagesOpen = exports.yseries:GetCurrentAppId('messages') if isMessagesOpen then print('Messages app is open') end
Modify Nui focus input
Useful when working on custom apps and dealing with input fields. By default, when an input field is focused in a custom app embedded in the phone, game keybinds (like WASD movement) will still trigger. Use this export to block game input while the user is typing.
lua-- focus - boolean (true = allow game input, false = block game input) exports.yseries:SetNuiFocusKeepInput(focus)
Example of how to trigger the NUI callback from the UI of your custom app.
javascript// Focus handlers const handleInputFocus = () => { fetchNui('toggle-NuiFocusKeepInput', false).catch(() => {}); // Block game input while typing }; const handleInputBlur = () => { fetchNui('toggle-NuiFocusKeepInput', true).catch(() => {}); // Re-enable game input }; // In your JSX <input type="text" onFocus={handleInputFocus} onBlur={handleInputBlur} />
Add the NUI callback to the client side of your custom app resource. This is necessary to allow the phone resource to control the focus of the input field.
lua-- Proxy NUI focus keep input to phone resource (for embedded apps with input fields) RegisterNuiCallback('toggle-NuiFocusKeepInput', function(focus, cb) if GetResourceState('yseries') == "started" then exports['yseries']:SetNuiFocusKeepInput(focus) end cb(true) end)