Skip to main content

Metadata Exports

RoadPhone Pro’s metadata system stores phone data directly on inventory items, enabling features like phone stealing and trading. These exports allow external resources to interact with phone metadata.
These exports only work when Config.UseMetadata = true in the phone configuration. They will return nil or false when metadata mode is disabled.

Helper Functions

GetPhoneMetadataOnly

Get the complete metadata object for a player’s active phone.
number
required
The player’s server ID.
table | nil
The complete phone metadata table, or nil if not found.
This is a lightweight function that uses the active phone slot. Use this when you only need to read metadata without modifying it.

UpdatePhoneMetadataField

Update a single top-level field in phone metadata.
number
required
The player’s server ID.
string
required
The metadata field name to update (e.g., 'phone_background').
any
required
The new value for the field. Use nil to remove the field.
boolean
true if successful, false otherwise.

UpdatePhoneMetadataNested

Update a nested field within phone metadata.
number
required
The player’s server ID.
string
required
The parent field name (e.g., 'phone_settings').
string
required
The child field name (e.g., 'brightness').
any
required
The new value for the nested field.

UpdatePhoneMetadataArray

Perform array operations (add/update/delete) on metadata arrays.
number
required
The player’s server ID.
string
required
The array field name (e.g., 'phone_contacts').
string
required
The operation type: 'add', 'update', or 'delete'.
any
required
For 'add'/'update': the item object. For 'delete': the ID value.
string
required
The field name used as identifier (e.g., 'id').
number
Optional maximum array size (only for 'add' operations).

Phone Number & Setup

GetPhoneNumberFromItem

Get the phone number from a player’s phone item.
number
required
The player’s server ID.
number
Optional specific inventory slot to check.
string, string, number, table
Returns phone number, item name, slot number, and full metadata.

AssignPhoneNumberToItem

Assign a new phone number to a phone item.
number
required
The player’s server ID.
string
required
The phone item name.
number
required
The inventory slot number.
boolean, string
Success status and the assigned phone number.

GetOrCreatePhoneNumber

Get the phone number for a player, creating one if necessary.
number
required
The player’s server ID.
string, boolean
The phone number and whether it was newly created.

GetPhoneSetupFromItem

Check if the phone has completed initial setup.
number
1 if setup is complete, 0 if setup is needed.

UpdatePhoneSetup

Update the phone setup status.
number
required
1 for complete, 0 for needs setup.

Background & Settings

GetPhoneBackground

Get the phone’s wallpaper background.
string | nil
The background URL/path, or nil if using default.

UpdatePhoneBackground

Set the phone’s wallpaper background.
string | nil
required
The background URL/path, or nil to reset to default.

GetPhoneSettingsFromMetadata

Get all phone settings.
table | nil
Settings object with: brightness, flightmode, large_app_icons, iconcolor, darkmode, timeCustomization.

UpdatePhoneSettings

Update phone settings.
table
required
Table with settings to update. Only provided keys will be changed.

PIN/Passcode

GetPhonePin

Get the phone’s PIN configuration.
table | nil
Table with pin (string, 6 digits) and pin_needed (0 or 1).

UpdatePhonePin

Update the phone’s PIN.
string
required
The 6-digit PIN code, or nil to remove.
number
required
1 to require PIN on unlock, 0 to disable.

Contacts

GetPhoneContacts

Get all contacts from the phone.
table
Array of contact objects.

AddContactToMetadata

Add a new contact.
table
required
Contact object with id, name, number, and optional avatar.

UpdateContactInMetadata

Update an existing contact.

DeleteContactFromMetadata

Delete a contact.

UpdatePhoneContacts

Replace the entire contacts array in metadata.
table
required
Array of contact objects to replace all existing contacts.

Notes

GetPhoneNotes

Get all notes from the phone.

AddNoteToMetadata

Add a new note.
table
required
Note object with id, title, content, created_at.

UpdateNoteInMetadata

Update an existing note.

DeleteNoteFromMetadata

Delete a note.

UpdatePhoneNotes

Replace the entire notes array in metadata.
table
required
Array of note objects to replace all existing notes.

Photos

GetPhonePhotos

Get all photos from the phone.

AddPhotoToMetadata

Add a new photo.
table
required
Photo object with id, url, created_at, and optional favorite.

UpdatePhotoInMetadata

Update photo properties (e.g., favorite status).

DeletePhotoFromMetadata

Delete a photo.

UpdatePhonePhotos

Replace the entire photos array in metadata.
table
required
Array of photo objects to replace all existing photos.

Albums

GetPhoneAlbumsFromMetadata

Get all photo albums from the phone.
number
required
The player’s server ID.
table
Array of album objects, or empty table if none exist.

AddAlbumToPhoneMetadata

Create a new album.
table
required
Album object with id, name, photoIds fields.

UpdateAlbumInMetadata

Update specific fields of an existing album.
any
required
The album’s identifier.
table
required
Key/value pairs to merge into the album.

DeleteAlbumFromMetadata

Delete an album.
any
required
The album’s identifier.

AddPhotoToAlbumMetadata

Add a photo to an album. Skips duplicates.
any
required
The album’s identifier.
any
required
The photo’s identifier to add.
boolean
true on success (or if already exists), false if album not found.

RemovePhotoFromAlbumMetadata

Remove a photo from an album.
any
required
The album’s identifier.
any
required
The photo’s identifier to remove.

AddMultiplePhotosToAlbumMetadata

Add multiple photos to an album at once. Skips duplicates.
any
required
The album’s identifier.
table
required
Array of photo identifiers to add.

Alarms

GetPhoneAlarms

Get all alarms from the phone.

AddAlarmToMetadata

Add a new alarm.

UpdateAlarmInMetadata

Update an existing alarm.

DeleteAlarmFromMetadata

Delete an alarm.

UpdatePhoneAlarms

Replace all alarms on the phone at once.
number
required
The player’s server ID.
table
required
Array of alarm objects to set. Pass {} to clear all alarms.
boolean
true if the metadata was updated successfully, false otherwise.

Messages

GetPhoneMessages

Get all messages from the phone.

AddMessageToMetadata

Add a new message to the phone.

MarkMessagesReadInMetadata

Mark messages from a specific number as read.

UpdatePhoneMessages

Replace all messages on the phone at once. Messages are automatically limited to the configured maximum (default 300).
number
required
The player’s server ID.
table
required
Array of message objects to set.
number
Number of unread messages. Defaults to 0.
boolean
true if the metadata was updated successfully, false otherwise.

Radio Channels

GetRadioChannelsFromMetadata

Get saved radio channels.

AddRadioChannelToMetadata

Add a saved radio channel.

UpdateRadioChannelInMetadata

Update a saved radio channel.

DeleteRadioChannelFromMetadata

Delete a saved radio channel.

GetRadioRecentFromMetadata

Get recent radio frequencies.

AddRadioRecentToMetadata

Add a frequency to recent list.

ClearRadioRecentFromMetadata

Clear all recent frequencies.

UpdateRadioChannels

Replace all saved radio channels on the phone at once.
number
required
The player’s server ID.
table
required
Array of radio channel objects to set. Pass {} to clear all channels.
boolean
true if the metadata was updated successfully, false otherwise.

Social Media Accounts

TweetWave

Backwards Compatibility: The old *TwitterAccount* export names still work but are deprecated.

Connect


RoadID Account


App Layout

GetPhoneAppsFromMetadata

Get installed apps and homescreen layout.
table | nil
Object with installed (array of app IDs) and homescreen (layout data).

UpdateInstalledApps

Update the list of installed apps.

UpdateHomescreenLayout

Update the homescreen layout (pages and dock).

UpdatePhoneApps

Replace the entire apps data (installed apps and homescreen layout) at once.
number
required
The player’s server ID.
table
required
Object with installed (array of app IDs) and homescreen (layout data).
boolean
true if the metadata was updated successfully, false otherwise.

Backup System

Backup functions require Config.BackupEnabled = true in the configuration.

CreatePhoneBackup

Create a backup of all phone data.
string
Optional custom name for the backup. Defaults to timestamp.
string
'manual' or 'auto'. Defaults to 'manual'.

GetPhoneBackups

Get all backups for the player.
table
Array of backup objects with backup_id, backup_name, created_at, backup_type.

RestorePhoneBackup

Restore phone data from a backup.
string
required
The UUID of the backup to restore.

DeletePhoneBackup

Delete a backup.

Metadata Limits

Phone metadata has built-in limits to prevent inventory bloat: When limits are exceeded, the oldest items are automatically removed.

Complete Example