> For the complete documentation index, see [llms.txt](https://atascripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atascripts.gitbook.io/docs/resource/xvi-phone/exports.md). Agents can also search and read this documentation through its [MCP server](https://atascripts.gitbook.io/docs/~gitbook/mcp).

# Exports

Connect your own scripts to XVI Phone.

Use these to connect XVI Phone to your own scripts.

## Server exports

### getPhoneNumber

Gets an online player's phone number. Handy for billing, job menus and ID cards.

```lua
local number = exports.ata_phone:getPhoneNumber(source)
```

| Param    | Type   | Description      |
| -------- | ------ | ---------------- |
| `source` | number | Player server ID |

**Returns:** `string` or `nil` if the player isn't loaded.

### getSourceByNumber

Finds the online player who owns a number.

```lua
local target = exports.ata_phone:getSourceByNumber('3175550123')
```

**Returns:** `number` or `nil` if nobody online has that number.

### hasPhone

Checks if a player can use a phone. Always `true` when `Config.NeedItem` is `false`.

```lua
local hasPhone = exports.ata_phone:hasPhone(source)
```

**Returns:** `boolean`

### isInCall

Checks if a player is on a call. Calling and ringing count too.

```lua
local busy = exports.ata_phone:isInCall(source)
```

**Returns:** `boolean`

### sendNotification

Shows a phone notification to one player.

```lua
exports.ata_phone:sendNotification(source, 'Maze Bank', 'Your paycheck has arrived')
```

| Param    | Type   | Description          |
| -------- | ------ | -------------------- |
| `source` | number | Player server ID     |
| `title`  | string | Top line of the card |
| `text`   | string | Message on the card  |

## Client exports

### isOpen

Returns `true` while the phone is open. Useful for blocking your own menus or keybinds.

```lua
if exports.ata_phone:isOpen() then return end
```

### hasPhone

Returns `true` if the local player can use a phone.

```lua
local hasPhone = exports.ata_phone:hasPhone()
```

### isInCall

Returns `true` while the local player is calling, ringing or talking.

```lua
local busy = exports.ata_phone:isInCall()
```

### closePhone

Puts the phone away. Call it before cutscenes, arrests or anything that needs the player's hands.

```lua
exports.ata_phone:closePhone()
```

### sendNotification

Shows a phone notification to the local player.

```lua
exports.ata_phone:sendNotification('Dispatch', 'New job available')
```

### usePhoneItem

Used by the ox\_inventory items. It opens the phone and picks that item's color, so you won't usually call it yourself.

```lua
client = { export = 'ata_phone.usePhoneItem' }
```

## Example

Send a text-style alert when a player gets a fine:

```lua
RegisterNetEvent('myscript:finePlayer', function(target, amount)
    if not exports.ata_phone:hasPhone(target) then return end
    exports.ata_phone:sendNotification(target, 'LSPD', ('You received a $%s fine'):format(amount))
end)
```

{% hint style="warning" %}
Always validate who triggers events like this on the server, so cheaters can't send fake fines.
{% endhint %}
