Jixryo Tablet

The suite's tablet. A lock screen, home screen, notifications, settings, notes and a calculator on one device that any script adds its app to, and that folds into a phone form.

Version 1.1.0 Updated See it on its script page

On this page

Jixryo Tablet is the suite's own tablet, in the suite's look: italic capitals, see-through black blocks, a white selection ending on the blue slash. It runs alongside lb-tablet, and the police MDT is an app on it (Jixryo MDT). Version 1.1.0 makes it one device with two items: the tablet item brings it out unfolded, the phone item folded.

What players get

  • The device. A flat black slab with a 4:3 screen, held in the reading idle while the game behind it blurs. lb-phone and lb-tablet go away when it comes out. It goes away on Esc, when you die, ragdoll or swim, when the item that brought it out leaves your pockets, and when the resource stops.
  • Folded. The phone item brings the same device out folded: in the right hand in the phone reading pose, no blur, and you can walk with it out (looking around, shooting and the pause menu wait; typing in a field stops the walking until the field lets go). Using the item of the form on screen puts it away; using the other one folds or unfolds it, and the page folds and unfolds it too.
  • Lock screen (on by default, per character): the time, whose tablet it is, and the notifications waiting. Enter, Space or a click unlocks. Opening an app from its own item skips it.
  • Home screen. The clock and the latest notifications on the left, the apps on the right. Arrow keys move, Enter opens, and the bar at the bottom of an app goes home.
  • Status bar. Game time, the notification bell, signal (full in Los Santos, fewer bars further out) and a battery that drains while the tablet is out and charges while it is away. It is for the feel and never runs flat.
  • Notifications. A banner while the tablet is out, a HUD notification while it is away, badges on the app tiles and the full list behind the bell. No banner when the app it came from is already on screen. Tapping one opens its app on the page it names. The last 50 are kept.
  • Built-in apps. Settings (wallpaper, brightness, menu sounds, lock screen, which apps may notify, about), Notes (per character, stored on the server, saves on its own) and Calculator (keypad or keyboard).
  • Apps from other scripts. On it now: TrailCam (Jixryo Trail cams; its jixryo_trailcam_tablet item opens the tablet straight onto it), Techno Unlimited (the shop for everyone and the Work pages for its staff), Cameras (Jixryo Cameras) and the police MDT (Jixryo MDT, tablet only).

What staff get

  • One export adds an app. Any resource calls AddApp with its page and icon; job lists decide who sees the tile, and the app's own server checks everything it does. A notification or Open can name a page inside the app (a route), and the resource pushes into its page with SendAppMessage.
  • Everything the page sends is checked on the server. Settings and notes live per character in the database; a character keeps 50 notes.
  • Config. Each built-in app can be turned off or limited to jobs, the wallpapers are a list, and every new character starts from Config.defaultSettings.
  • Hooks. onOpen and onClose run when they arrive as Lua functions. The tablet checks for a function only; a function handed over through another resource's export arrives as a callable reference, which the phone's suite calls "the tablet's old bug" [inferred: hooks from another resource may not run on the tablet].

Install

  1. What it replaces. Nothing. It runs alongside lb-tablet and puts lb-phone and lb-tablet away when it comes out.

  2. Order. Start it after Jixryo Core and before the scripts that add apps. It depends on ox_lib, oxmysql, qbx_core and Jixryo Core.

    server.cfg
    ensure jixryo_core
    ensure jixryo_tablet
    ensure jixryo_trailcam
    ensure jixryo_trailcam_app
  3. Items. Add the tablet item to ox_inventory/data/items.lua, with its picture in ox_inventory/web/images/jixryo_tablet.png. The name must match Config.item; the label and description are yours.

    lua
    ['jixryo_tablet'] = {
        label = 'Tablet',
        weight = 600,
        stack = false,
        close = true,
        description = 'Your apps, notes and notifications.',
        client = { image = 'jixryo_tablet.png' }
    },

    The phone item (Config.phoneItem, jixryo_phone by default) brings the device out folded. It is the same item Jixryo Phone uses, and both resources register it as useable, so run only one of them on it: with Jixryo Phone installed, set Config.phoneItem = '' here [inferred: qbx_core keeps one handler per item name].

  4. Database. The tables jixryo_tablet_settings and jixryo_tablet_notes are created on the first start, as one Jixryo Core migration step.

  5. Optional keys. Config.key brings the tablet out and Config.phoneKey the phone form, while the player carries the item. Both are empty by default; leave the phone's empty while lb-phone has its own key.

  6. Restart the whole server, not just the resource.

How other scripts' calls behave

  • It answers as itself only. Its exports live under jixryo_tablet. AddApp takes the same table as Jixryo Phone's, so one page serves both devices.
  • Add your app again when the tablet restarts (onResourceStart); it goes away by itself when your resource stops. List your page and icon in your own manifest's files.
  • Other devices. When it comes out it asks lb-phone and lb-tablet whether they are open (IsOpen) and puts them away (ToggleOpen), while Config.closePhone is on.
  • It uses Jixryo Core's HUD (the blur behind the tablet, notifications, sounds), player, validation, rate limit and database modules; qbx_core's useable items; and ox_inventory's item search to see the item is still in your pockets.
  • Who sees what. Job lists on an app, and on the built-in apps in Config.apps, only decide what shows.

Its own API

Client exports:

ExportWhat it does
AddApp({ id, name, icon, ui, jobs?, forms?, onOpen?, onClose? })Adds an app. id is letters, digits, _ and - (up to 32), name up to 24 characters, ui and icon pages served from a resource (https://cfx-nui-<resource>/...), icon one colour on transparent (the tablet tints it). forms lists the layouts the page has, phone and tablet; without it the app is tablet only, and opening it folded unfolds the device. A built-in app's id is refused. Returns true or false.
RemoveApp(id)Takes an app off; only the resource that added it.
SendAppMessage(id, payload)Pushes into the app's page as a window message; only the resource that added it, and only while the app is on screen.
Notify({ app, title?, message, quiet?, route? })A notification. quiet keeps it in the list with no HUD pop-up while the tablet is away; route is the page of your app a tap opens.
Open(appId?, { route?, form?, item? })Brings the tablet out, optionally straight onto settings, notes, calculator or an added app, on one of its pages. form is phone or tablet; without it, the form it was last put away in. item names the item it should follow: it goes away when that item does.
Close(), IsOpen()Puts it away; whether it is out.
GetForm()phone or tablet while it is out, else nothing.
GetCurrentApp()The id of the app on screen.
SoundsOn()Whether this character has menu sounds on; play your page's sounds only then.

Server export: Notify(src, { app, title?, message, icon?, quiet?, route? }), true when the player is in the city.

Local events (client): jixryo_tablet:client:opened (form), jixryo_tablet:client:closed, jixryo_tablet:client:form (form), jixryo_tablet:client:appOpened (id), jixryo_tablet:client:appClosed (id).

Your page fills the whole 4:3 screen. Keep the top 2.4 rem (the status bar) and the bottom 1.3 rem (the home bar) clear, about 4.7% and 2.5% of the frame's height. It talks to your own resource with fetch to your NUI callbacks. It can post to the tablet { jxTablet: 'escape' } (forward Esc when you did not use it), 'home', 'close', 'ready', { jxTablet: 'notify', title, message }, { jxTablet: 'badge', count } and { jxTablet: 'typing', on }. It gets { jxTablet: 'resume' } when the tablet comes back out with your app still open, { jxTablet: 'route', route } when a tapped notification or Open names a page (a route is letters, digits, _, - and /, up to 48 characters, and can arrive before your page is ready), and { jxTablet: 'form', form } when the device folds or unfolds. The suite's UI kit does all of this with one call in the page's entry.

Commands and keybinds

There are no commands.

WhereKeyWhat it does
AnywhereEscCloses a dialog or the notification list, then puts the tablet away
Lock screenEnter, Space or a clickUnlocks
HomeArrows, EnterMove, open
An appThe bar at the bottomHome
CalculatorDigits, + - * / %, Enter or =, Backspace, Delete or C
NotesCtrl+SSaves now (it also saves on its own)
The itemsUsing oneThe tablet item brings it out unfolded, the phone item folded; the item of the form on screen puts it away, the other folds or unfolds it
Config.key, Config.phoneKey (off by default)Keybinds that bring each form out while you carry its item; players rebind them in GTA's key settings under FiveM

Configuration

config.lua:

KeyDefaultWhat it does
item'jixryo_tablet'The tablet item
phoneItem'jixryo_phone'The item that brings the device out folded; empty turns the phone form's item off
key, phoneKey'', ''Keys that bring each form out; empty is the item only
deviceprop_cs_tablet in the left hand, the bus passenger tablet idle, blur trueThe tablet in hand, and whether the game blurs behind it
phoneprop_npc_phone_02 in the right hand, the phone reading pose, walk trueThe phone form in hand, and walking with it out
closePhonetruePut lb-phone and lb-tablet away when it comes out
hudNotificationstrueNotifications that arrive while it is away also show on the HUD
batterydrain 1.0, charge 3.0The status bar's battery, percent a minute out and away
signalcentre in Los Santos, full 3500 m, none 9000 mSignal bars by distance from the city
notesmax 50, title 48, body 4000Notes per character and their lengths
appssettings, notes, calculator, each enabledThe built-in apps; jobs on one limits who sees it
wallpapersgraphite, night, slash, dusk, steelThe wallpapers the page draws
defaultSettingswallpaper graphite, brightness 1.0, sounds on, lock on, nothing mutedEvery new character's settings

Security

  • Everything the page sends is checked on the server, and a character only ever reads and changes their own rows: settings and notes are keyed by citizen id.
  • Settings. Only known values survive: a wallpaper from the list, brightness 0.4 to 1, the sounds and lock switches, and up to 40 muted app ids; anything wrong falls back to the default.
  • Notes. Line breaks are kept, other control characters dropped, the text must be valid UTF-8 and is cut at 4000 characters; the title comes from the first line when none is given; 50 per character.
  • Rate limits on settings and notes, with a lock on saving a note.
  • The client side. AddApp takes only pages served from a resource and never a built-in app's id; RemoveApp and SendAppMessage work only for the resource that added the app; an added app's page can notify and set a badge only as itself. The device goes away when the item that brought it out leaves your pockets.
  • The Notify export reaches only a player who is in the city.
  • The status bar's battery is cosmetic and lives on the client; nothing depends on it.

Tests

Jixryo Tablet has no automated suite of its own. The scripts that put apps on it stand it in: the MDT and Cameras suites use a stand-in Notify, and Jixryo Phone's client suite checks the same AddApp contract on the phone.

Check it in game

  1. Use the tablet item: it comes out unfolded in the left hand, the game blurs behind it, and the lock screen shows the time and your name. Enter unlocks.
  2. Home: the arrows move between apps and Enter opens Notes. Write a note, put the tablet away and bring it out: it is there, and after a relog too.
  3. Settings: change the wallpaper and brightness, turn the lock screen off. Next time it opens on the home screen.
  4. Use the phone item: the device comes out folded in the right hand with no blur, and you can walk with it out. Type in Notes: you stop walking while the field has the keys. Use the tablet item while it is out: it unfolds.
  5. With an app that notifies (the MDT or TrailCam): a banner while the tablet is out, a HUD notification while it is away, a badge on the tile, and the list behind the bell. Tap one: its app opens.
  6. Esc puts it away. Ragdoll or die with it out: it goes away. Drop the item while it is out: it goes away.
Next step

Ready to look around?

Browse the suite, or paste your server.cfg and see what each script does to your server.