# SERVER EXPORTS

### Generate Phone Number

Generates a new, unique, random phone number formatted according to the server's configuration.

{% code overflow="wrap" lineNumbers="true" %}

```lua
local newNumber = exports["17mov_Phone"]:GeneratePhoneNumber()
```

{% endcode %}

**Returns:**

* `string`: The generated phone number.

### Get Identifier From Number

Retrieves the player identifier (license) associated with a specific phone number. This function works even if the player is offline, as it checks the database.

{% code overflow="wrap" lineNumbers="true" %}

```lua
local identifier = exports["17mov_Phone"]:GetIdentifierFromNumber(number)
```

{% endcode %}

**Returns:**

* `string`: The identifier assigned to the given phone number.

<table><thead><tr><th width="124" align="center">Argument</th><th width="158" align="center">Type</th><th width="104" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">number</td><td align="center"><code>number | string</code></td><td align="center">❌</td><td>A target phone number</td></tr></tbody></table>

### Get Number From Player

Retrieves the phone number currently active on a player's device using their Server ID (Source).

<pre class="language-lua" data-overflow="wrap" data-line-numbers><code class="lang-lua"><strong>local phoneNumber = exports["17mov_Phone"]:GetNumberFromPlayer(src)
</strong></code></pre>

**Returns:**

* `string`: The active phone number of the player.

<table><thead><tr><th width="116" align="center">Argument</th><th width="89" align="center">Type</th><th width="109" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's server ID (source).</td></tr></tbody></table>

### GetNumberFromIdentifier

Retrieves the phone number currently in use by a player based on their unique identifier

```lua
local playerNumber = exports["17mov_Phone"]:GetNumberFromIdentifier(identifier)
```

#### Returns:

* `string` / `nil` playerNumber: The phone number currently used by the player, or `nil` if the player is offline or has no active number.

#### Arguments:

<table><thead><tr><th width="116" align="center">Argument</th><th width="89" align="center">Type</th><th width="109" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">identifier</td><td align="center"><code>string</code></td><td align="center">❌</td><td>Player identifier</td></tr></tbody></table>

### Get Player Source From Number

Retrieves the Server ID (Source) of an online player currently using the specified phone number.

{% code overflow="wrap" lineNumbers="true" %}

```lua
local src = exports["17mov_Phone"]:GetPlayerSrcFromActiveNumber(number)
```

{% endcode %}

**Returns:**

* `number` | `nil`: The player's server ID if they are online and using the number, otherwise `nil`.

<table><thead><tr><th width="116" align="center">Argument</th><th width="156" align="center">Type</th><th width="106" align="center">Optional</th><th align="center">Explanation</th></tr></thead><tbody><tr><td align="center">number</td><td align="center"><code>number | string</code></td><td align="center">❌</td><td align="center">A target phone number</td></tr></tbody></table>

### Set Phone Block State

Blocks or unblocks a player from using their phone. When blocked, the player cannot open the phone interface. This is useful for situations like being handcuffed, unconscious, or in a restricted zone.

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:SetPlayerPhoneBlockState(src, state)
```

{% endcode %}

<table><thead><tr><th width="116" align="center">Argument</th><th width="95" align="center">Type</th><th width="108" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's server ID (source).</td></tr><tr><td align="center">state</td><td align="center"><code>boolean</code></td><td align="center">❌</td><td><code>true</code> to block the phone, <code>false</code> to unblock.</td></tr></tbody></table>

### Change User Password

Changes the user password for a specific application account (e.g., Darkchat, Swiply). This is useful for "forgot password" mechanics or admin tools.

{% code overflow="wrap" lineNumbers="true" %}

```lua
local success = exports["17mov_Phone"]:ChangeUserPassword(app, username, newPassword)
```

{% endcode %}

**Returns:**

* `boolean`: `true` if the password was changed successfully.

<table><thead><tr><th width="132" align="center">Argument</th><th width="89" align="center">Type</th><th width="109" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">app</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The internal name of the app (e.g., <code>"darkchat"</code>, <code>"swiply"</code>).</td></tr><tr><td align="center">username</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The username of the account.</td></tr><tr><td align="center">newPassword</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The new password to set.</td></tr></tbody></table>

### Send Notification (By Source)

Sends a notification to a player using their Server ID (Source).

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:SendNotificationToSrc(src, notification)
```

{% endcode %}

<table><thead><tr><th width="112" align="center">Argument</th><th width="124" align="center">Type</th><th width="106" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The player's server ID (source).</td></tr><tr><td align="center">notification</td><td align="center"><code>Notification</code></td><td align="center">❌</td><td>The notification data object.</td></tr></tbody></table>

<details>

<summary>Notification Structure</summary>

```
{
    app = "MESSAGES", -- App identifier (e.g., "MESSAGES", "BANK", "SYSTEM")
    title = "New Alert", -- Title string or ReplaceType object
    message = "This is a test notification", -- Message string or ReplaceType object
    data = {
        href = "/messages/1", -- (Optional) Internal link to open on click
        alwaysShow = true -- (Optional) Show even if app is open
    }
}
```

</details>

<details>

<summary>ReplaceType Structure (Localization)</summary>

Use this structure if you want to use localized strings with dynamic replacements.

```
{
    key = "LocaleKey", -- e.g., "Messages:NewMessage"
    replace = "%s", -- Placeholder to replace
    value = "John Doe" -- Value to insert
}
```

</details>

### Send Notification (By Number)

Sends a notification to a player using their phone number.

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:SendNotificationToNumber(number, notification)
```

{% endcode %}

<table><thead><tr><th width="114" align="center">Argument</th><th width="139" align="center">Type</th><th width="115" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">number</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The target phone number.</td></tr><tr><td align="center">notification</td><td align="center"><code>Notification</code></td><td align="center">❌</td><td>The notification data object (same structure as above).</td></tr></tbody></table>

### SendNotificationToEveryone

Sends a notification to all players

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:SendNotificationToEveryone(notification)
```

{% endcode %}

<table><thead><tr><th width="114" align="center">Argument</th><th width="139" align="center">Type</th><th width="115" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">notification</td><td align="center"><code>Notification</code></td><td align="center">❌</td><td>The notification data object (same structure as above).</td></tr></tbody></table>

### GetSignalTowers

Returns a table with all Signal Towers from config

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:GetSignalTowers()
```

{% endcode %}

**Returns:**

* `{coords: vector3, radius: number}[]`&#x20;

### GetSignalLevelForCoords

Returns a 0-4 value that represent signal strenght for given coordinates

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:GetSignalLevelForCoords(coords)
```

{% endcode %}

<table><thead><tr><th width="118" align="center">Argument</th><th width="99" align="center">Type</th><th width="111" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">coords</td><td align="center"><code>vector3</code></td><td align="center">❌</td><td>Coords to check signal</td></tr></tbody></table>

**Returns:**

* `number (0-4)`&#x20;

### GetPlayerSignalLevel

Returns a current player signal strenght&#x20;

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:GetPlayerSignalLevel(playerId)
```

{% endcode %}

<table><thead><tr><th width="118" align="center">Argument</th><th width="99" align="center">Type</th><th width="111" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">playerId</td><td align="center"><code>number</code></td><td align="center">❌</td><td>Player ID to check</td></tr></tbody></table>

**Returns:**

* `number (0-4)`&#x20;

### AddSimcard

Adding a given player simcard with given number.

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:AddSimcard(playerId, number)
```

{% endcode %}

<table><thead><tr><th width="118" align="center">Argument</th><th width="99" align="center">Type</th><th width="111" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">playerId</td><td align="center"><code>number</code></td><td align="center">❌</td><td>Player ID to Give</td></tr><tr><td align="center">number</td><td align="center"><code>string</code></td><td align="center">✅</td><td>What number should be assigned. If no number is given then script will generate random</td></tr></tbody></table>

**Returns:**

* `boolean` true if sucess&#x20;

### EjectSimCard

Eject simcard with given number, or if no number is given, then current phone will be ejected

{% code overflow="wrap" lineNumbers="true" %}

```lua
exports["17mov_Phone"]:EjectSimCard(playerId, number)
```

{% endcode %}

**Returns:**

* `boolean` true if sucess&#x20;

<table><thead><tr><th width="118" align="center">Argument</th><th width="99" align="center">Type</th><th width="111" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">playerId</td><td align="center"><code>number</code></td><td align="center">❌</td><td>Player ID to Eject</td></tr><tr><td align="center">number</td><td align="center"><code>string</code></td><td align="center">✅</td><td>What number should be ejected. If no number is given, then current phone number will eject.</td></tr></tbody></table>

### GetPhoneSettings

Returns all settings and configuration for a specific phone number.

{% code lineNumbers="true" %}

```lua
local settings = exports["17mov_Phone"]:GetPhoneSettings(number)
```

{% endcode %}

#### Returns:

* `table` PhoneSettings: A table containing all device configurations.

<details>

<summary>PhoneSettings class</summary>

```lua
---@class PhoneSettings
---@field number string Phone number
---@field configured boolean Whether phone is configured
---@field language string Language code
---@field wallpaper string | nil Wallpaper url | nil for default
---@field theme 'dark' | 'light' Theme
---@field frameColor string Frame color hex code
---@field planemode boolean Whether planemode is enabled
---@field easydrop boolean Whether easydrop is enabled
---@field location boolean Whether location is enabled
---@field silentMode boolean Whether silent mode is enabled
---@field pinCode string | nil Phone pin code | nil if not set
---@field faceId string | nil Face ID owner identifier | nil if not set
---@field ringtoneVolume number Ringtone volume (0-100)
---@field notificationVolume number Notifications volume (0-100)
---@field mediaVolume number Media volume (0-100)
---@field ringtoneSound string | nil Ringtone sound name | nil for default
---@field notificationSound string | nil Notification sound name | nil for default
---@field streamerMode boolean Whether streamer mode is enabled
---@field scale number | nil Phone scale | nil for default
---@field companiesCalls boolean Whether companies call are enabled
---@field companiesNotifications boolean Whether companies notifications are enabled
---@field mycard {firstname: string; lastname: string; image: string; notes: string} | nil Player phone card data | nil if not set
---@field hideNumber boolean Whether to hide number on calls
```

</details>

<table><thead><tr><th width="124" align="center">Argument</th><th width="158" align="center">Type</th><th width="104" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">number</td><td align="center"><code>string</code></td><td align="center">❌</td><td>A target phone number</td></tr></tbody></table>

### GetConfig

Retrieves the full phone configuration, allowing other scripts to read global settings, available applications, and their specific parameters.

{% code lineNumbers="true" %}

```lua
local phoneConfig = exports["17mov_Phone"]:GetConfig()
```

{% endcode %}

#### Returns:

* `table` Config: The main configuration table of the script.

<details>

<summary>Usage Examples:</summary>

```lua
local config = exports["17mov_Phone"]:GetConfig()

-- Check if phones are unique (metadata-based)
if config.UniquePhones then
    print("The server is using unique phone items")
end

-- Accessing specific app settings
local showNumber = config.Apps['Companies'].ShowCompanyExactNumber
print("Show exact company number: " .. tostring(showNumber))
```

</details>

### SetPinCodeBySrc

Sets the phone PIN code for a specific player. This function updates the PIN in the database and synchronizes it with the player's client.

{% code lineNumbers="true" %}

```lua
local success = exports["17mov_Phone"]:SetPinCodeBySrc(src, pin)
```

{% endcode %}

#### Returns:

* `boolean`: Returns `true` if the PIN was successfully updated, `false` otherwise (e.g., if the PIN is too long or not a string).

<table><thead><tr><th width="124" align="center">Argument</th><th width="158" align="center">Type</th><th width="104" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The server ID (source) of the player.</td></tr><tr><td align="center">pin</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The new PIN code. Max 4 characters.</td></tr></tbody></table>
