Docs
RARX Phone cover

RARX Phone · Installation

Installation

Install RARX Phone, create the phone items, let the database install itself and test it before going live.

  • Qbox
  • QBCore
  • ESX
  • v2.0.0
  • rarx_phone

Before you start#

Make sure the requirements are installed: ox_lib, oxmysql, a supported framework (Qbox, QBCore or ESX Legacy), a supported inventory, and MySQL 5.7 / 8 or MariaDB 10.x.

Take a backup of your database before the first start (for example with mysqldump).

Install#

  1. Add the resource

    Place the rarx_phone folder in your resources directory. Keep the folder name rarx_phone: item exports such as rarx_phone.UsePhoneItem use it.

  2. Start it in server.cfg

    Start rarx_phone after ox_lib, oxmysql, your framework, your inventory and your voice resource. Framework and inventory are detected once, when the phone loads, so anything that starts later is not seen.

    server.cfg
    ensure ox_lib
    ensure oxmysql
    
    # your framework (qbx_core, qb-core or es_extended)
    ensure qbx_core
    
    # your inventory and voice resource
    ensure ox_inventory
    ensure pma-voice
    
    ensure rarx_phone
  3. Create the phone items

    Create one item per model you want to use: phone, ifruit26, ifruitduo and ifruitzfold. See Phone items below for your inventory.

  4. Start the server

    On first start the phone creates its database tables and applies pending migrations by itself. You do not need to import any SQL file. See Database.

    Check the server console for these lines:

    Text
    [rarx_phone] framework: qbx · inventario: ox
    [rarx_phone] SQL: base de datos instalada/actualizada (...)

    If it says framework: ninguno or inventario: ninguno, see Troubleshooting.

  5. Set the basics

    Open config/config.lua and review at least:

    • Config.DefaultLanguage: language for new phones ('es' by default; for example 'en').
    • Config.Framework and Config.Item.Inventory: leave 'auto' or force a value.
    • Config.Notify: notification resource used outside the phone ('rarx_notify' by default; ox_lib is used when it is not running).
    • Config.FineAccount and Config.Bills.Issuers: account that receives paid fines and jobs that can issue invoices and fines.

    The rest of the options are covered in Configuration. Invalid values are reported in the console at startup.

  6. Open the phone

    With a phone item in the inventory, players open the phone by using the item, with F1 or with /rarxphone. The key and command are Config.Keybind and Config.Command.

Phone items#

The item names are listed in Config.Item.Names in config/config.lua:

Item Opens
phone iFruit 17 (iFruitOS-style)
ifruit26 iFruit S26 (Andromeda-style)
ifruitduo iFruit Duo (iFruitOS-style foldable)
ifruitzfold iFruit Z Fold (Andromeda-style foldable)

The item rrxphone is also accepted and opens the iFruit 17. Phone items should not stack: each one carries its own number and device id in its metadata.

Add the items to your ox_inventory item list and point them to the phone export. Without client.export the item still works, because the phone also registers it as a usable item through your framework.

ox_inventory/data/items.lua
['phone'] = {
    label = 'iFruit 17',
    stack = false,
    client = { export = 'rarx_phone.UsePhoneItem' },
},
['ifruit26'] = {
    label = 'iFruit S26',
    stack = false,
    client = { export = 'rarx_phone.UsePhoneItem' },
},
['ifruitduo'] = {
    label = 'iFruit Duo',
    stack = false,
    client = { export = 'rarx_phone.UsePhoneItem' },
},
['ifruitzfold'] = {
    label = 'iFruit Z Fold',
    stack = false,
    client = { export = 'rarx_phone.UsePhoneItem' },
},

Set the weight, description and image the way you do for your other items.

The item definitions need client = { export = 'rarx_phone.UsePhoneItem' }. The phone does not register usable items with rarx_inventory, so the export is required.

Add the four items to your shared items as unique items that do not stack (one phone per slot). The phone registers them as usable automatically.

Versions of qb-inventory older than 2.0 cannot write metadata to a specific slot; with several phones in the inventory, the number may be written to the first one.

Add the four items to your inventory as usual. The phone registers them as usable automatically and stores the number and device id in the item metadata.

Add the four items to your items table. The phone registers them as usable automatically.

The ESX default inventory has no item metadata: Face Unlock per device is disabled (the PIN still works), the number is not stored in the item and using any phone item opens the player's first phone.

Database#

On every start the phone checks the database and installs what is missing:

  • It creates the missing tables from sql/rarx_phone.sql.
  • It applies, in order, the pending migrations from sql/migrations/ listed in sql/migrations/lista.txt, and records them in rarx_phone_migrations.
  • It is idempotent: it checks information_schema before creating tables, columns or indexes, so restarting is safe.
  • It never runs DROP, DELETE or TRUNCATE, and it only touches rarx_phone_* tables. Your framework tables are not modified.
  • If a statement fails, the console shows the file, the statement, the MySQL error and what to do. The rest is still applied, and the failed migration is retried on the next start.

The rest of the phone waits for the installation to finish before using the database.

Disable the automatic install#

Use either of these if you prefer to import the SQL yourself:

server.cfg
set rarx_phone_auto_sql 0
config/config.lua
Config.Database = {
    AutoInstall = false,
}

With the automatic install disabled, the database is not touched and the console lists the missing tables and pending migrations. Import sql/rarx_phone.sql and the files in sql/migrations/ (in the order of lista.txt) by hand.

set rarx_phone_migrate 1 forces the automatic install even when it is disabled by the convar or the config.

Convars#

All convars go in server.cfg, before ensure rarx_phone.

Convar Default Purpose
rarx_phone_preview 0 1 enables test mode.
rarx_phone_auto_sql 1 0 disables the automatic database install.
rarx_phone_migrate 0 1 forces the automatic database install.
rarx_phone_debug 0 1 enables debug output in the console.
rarx_phone_fivemanage_key empty FiveManage key for photo, video and audio uploads. rarx_uploader_key and fivemanage:key are also read, in that order.
rarx_phone_turn_token_id empty Cloudflare TURN key id for video calls.
rarx_phone_turn_api_token empty Cloudflare TURN API token for video calls.
rarxphone_gifs_key empty Tenor or Giphy API key for GIFs in Messages (name set by Config.Gifs.ApiKeyConvar).
rarx_phone_fivemanage_logs_key empty FiveManage key for logs when Config.Logs.Service = 'fivemanage' (falls back to fivemanage:key).

Use set, not setr, for keys and tokens so they stay on the server.

Test mode#

Test mode lets admins try RARX Phone on a running server while every other player keeps the phone they have now. It is off by default.

server.cfg
set rarx_phone_preview 1
ensure rarx_phone

While test mode is on:

  • rarx_phone does not register the F1 key and does not react to phone items for normal players.
  • It does not create sessions or show phone shops, coverage or notifications for anyone who has not activated it.
  • The server rejects every phone request from players who have not activated it.

Activate it for yourself#

You need admin rights for the phone (ACE rarxphone.admin, group.admin or group.god, the admin export in Config.Admin.Export, your framework's admin check, or a license in Config.Admin.Licenses) and a phone item in your inventory.

Command What it does
/movilprueba Activates test mode for you and opens the phone.
/movilprueba <model> Same, with a model: phone, ifruit26, ifruitduo or ifruitzfold.
/movilprueba off Deactivates test mode for you.

Once activated, F3 opens and closes the phone (players can rebind it in the FiveM key bindings; the default is Config.Keys.Preview in config/funciones.lua). After editing files, run ensure rarx_phone again.

These commands only exist while rarx_phone_preview is 1, and they do nothing from the server console.

Go live#

  1. Back up your database.
  2. Set set rarx_phone_preview 0 in server.cfg, or remove the line (the default is 0).
  3. Stop your previous phone resource. If it was lb-phone, see Migrate from lb-phone to keep its data.
  4. Restart the whole server.

With test mode off, rarx_phone registers F1 and the phone items for every player.

To roll back test mode, run stop rarx_phone; nothing else changes. To roll back after going live, undo your server.cfg changes and restart.

Optional services#

Photo, video and audio uploads#

By default uploads go to FiveManage:

  • If the resource set in Config.Uploader.Resource (rarx_uploader by default) is running, the phone uploads through its UploadMedia export.
  • Otherwise it uploads directly to FiveManage with the key from the rarx_phone_fivemanage_key convar.
server.cfg
set rarx_phone_fivemanage_key "your-fivemanage-key"

You can also set Config.Uploader.Method to 'resource' (only the upload resource) or 'custom' (your own endpoint in Config.Uploader.Custom, with Url and Headers). Header values written as convar:<name> are read from that convar, so keys never sit in the config file.

TURN for video calls#

Video calls work out of the box with STUN, and fall back to frames relayed by the server when a direct connection is not possible. Adding Cloudflare TURN makes direct video work on more networks. With Config.WebRTC.Turn = 'cloudflare' (default), set:

server.cfg
set rarx_phone_turn_token_id "your-turn-key-id"
set rarx_phone_turn_api_token "your-turn-api-token"

GIFs#

GIF search in Messages needs a Tenor or Giphy key. Choose the provider in config/gifs.lua (Config.Gifs.Provider) and set the key in the convar; without a key the GIF picker does not appear.

server.cfg
set rarxphone_gifs_key "your-api-key"

First test checklist#

  • Open the phone on each of the four models and open and close the foldables.
  • Set a PIN and Face Unlock (Settings), close and open the phone: Face Unlock should unlock it.
  • Call between two players: audio, mute, speaker, hang up, and a missed call that goes to voicemail.
  • Video call: both sides see the game view.
  • Messages with a photo, a location and money; send a mail; take photos and check the gallery.
  • Bank: a small transfer; create and pay an invoice.
  • If something fails, check the client F8 console and the server console.

Troubleshooting#

The console shows framework: ninguno or inventario: ninguno

The framework or inventory started after rarx_phone, or is not a supported one. Move ensure rarx_phone below them in server.cfg and restart rarx_phone. You can also force them with Config.Framework and Config.Item.Inventory.

The console says the SQL auto-install is disabled

rarx_phone_auto_sql is 0 or Config.Database.AutoInstall is false. Remove that setting, or import sql/rarx_phone.sql and the pending migrations by hand. The warning lists what is missing.

SQL: information_schema cannot be read

Nothing is installed in this case. Check mysql_connection_string and the permissions of the MySQL user.

A migration failed

The console shows the file, the statement, the MySQL error and what to do. Fix the cause and restart: failed migrations are not marked as applied and are retried on the next start.

F1 or the phone item opens the wrong phone

Two phone resources are running and both use the phone item and the F1 key. Keep only one running, or use test mode while you try RARX Phone.

Photos or videos do not upload

No upload method is available: start the upload resource from Config.Uploader.Resource, or set rarx_phone_fivemanage_key. Uploads can also be turned off with Config.Features.Uploads in config/funciones.lua.

Nothing happens with /movilprueba

Test mode is off (rarx_phone_preview is not 1), you are not an admin for the phone, or you ran it from the server console. Run it in game as an admin.