
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#
Add the resource
Place the
rarx_phonefolder in yourresourcesdirectory. Keep the folder namerarx_phone: item exports such asrarx_phone.UsePhoneItemuse it.Start it in server.cfg
Start
rarx_phoneafterox_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.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_phoneCreate the phone items
Create one item per model you want to use:
phone,ifruit26,ifruitduoandifruitzfold. See Phone items below for your inventory.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:
[rarx_phone] framework: qbx · inventario: ox [rarx_phone] SQL: base de datos instalada/actualizada (...)If it says
framework: ningunoorinventario: ninguno, see Troubleshooting.Set the basics
Open
config/config.luaand review at least:Config.DefaultLanguage: language for new phones ('es'by default; for example'en').Config.FrameworkandConfig.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.FineAccountandConfig.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.
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 areConfig.KeybindandConfig.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.
['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 insql/migrations/lista.txt, and records them inrarx_phone_migrations. - It is idempotent: it checks
information_schemabefore creating tables, columns or indexes, so restarting is safe. - It never runs
DROP,DELETEorTRUNCATE, and it only touchesrarx_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:
set rarx_phone_auto_sql 0Config.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.
set rarx_phone_preview 1
ensure rarx_phoneWhile test mode is on:
rarx_phonedoes 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#
- Back up your database.
- Set
set rarx_phone_preview 0inserver.cfg, or remove the line (the default is0). - Stop your previous phone resource. If it was lb-phone, see Migrate from lb-phone to keep its data.
- 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_uploaderby default) is running, the phone uploads through itsUploadMediaexport. - Otherwise it uploads directly to FiveManage with the key from the
rarx_phone_fivemanage_keyconvar.
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:
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.
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.
