# Exports

## Template using Exports

{% embed url="<https://github.com/Geloteee/nPhone-test>" %}

## Client Exports

### Set phone display

This export will change the phone display status, it can be <mark style="color:green;">**true**</mark> or <mark style="color:red;">**false**</mark>:

```lua
-- status: bool

exports["nPhone"]:SetPhoneDisplayStatus(status)
```

### Get phone display

This export will get the current phone display status, it can return <mark style="color:green;">**true**</mark> or <mark style="color:red;">**false**</mark>:

```lua
local displayStatus = exports["nPhone"]:GetPhoneStatus()
```

### Get phone availability

This export will get the current phone availability status, it can return <mark style="color:green;">**true**</mark> or <mark style="color:red;">**false**</mark>:

```lua
local availabilityStatus = exports["nPhone"]:GetPhoneAvailability()
```

### Set phone availability

This export will change the availability of the current phone:

```lua
-- status: bool

exports["nPhone"]:SetPhoneAvailability(status)
```

### Show notification

This export will show a notification to the player if the player owns a phone:

```lua
-- title: string
-- text: string
-- time: number
-- img: string
-- sound: string

exports["nPhone"]:ShowNotification(title, text, time, img, sound)
```

### Set flashlight status

This export will change the status of the flashlight, if the player owns a phone:

```lua
-- status: bool

exports["nPhone"]:SetFlashlightStatus(status)
```

### Get flashlight status

This export will get the current flashlight status, it can return <mark style="color:green;">**true**</mark> or <mark style="color:red;">**false**</mark>:

<pre class="language-lua"><code class="lang-lua">-- status: bool

<strong>local flashlightStatus = exports["nPhone"]:GetFlashlightStatus(status)
</strong></code></pre>

## Server Exports

### Set verified status

This export will change the verified status of the user in the app selected:

```lua
-- appName: string
-- username: string
-- status: bool

-- Available apps: y

exports["nPhone"]:SetVerifiedStatus(appName, username, status)
```

### Get verified status

This export will get the verified status of the user in the app selected:

```lua
-- appName: string
-- username: string
-- cb: function

-- Available apps: y

exports["nPhone"]:GetVerifiedStatus(appName, username, function(status)
    print(status)
end)
```

### Set account password

This export will change the account password of the user in the app selected:

```lua
-- appName: string
-- username: string
-- newPassword: string

-- Available apps: nCloud

exports["nPhone"]:ChangeAccountPassword(appName, username, newPassword)
```

### Get app post

This export will get the post content in the app selected:

```lua
-- appName: string
-- username: string
-- cb: function

-- Available apps: y, mail

exports["nPhone"]:GetAppPost(appName, postId, function(content)
    print(json.decode(content))
end)
```

### Remove app post

This export will remove the post in the app selected:

```lua
-- appName: string
-- postId: string

-- Available apps: y, mail

exports["nPhone"]:RemoveAppPost(appName, postId)
```

### Reset phone

This export will reset the selected phone:

```lua
-- phoneId: string

exports["nPhone"]:ResetSmartphone(phoneId)
```

### Get source from number

This export will get the source from a phone number:

<pre class="language-lua"><code class="lang-lua">-- phoneNumber: string

<strong>local sourceNumber = exports["nPhone"]:GetSourceFromNumber(phoneNumber)
</strong></code></pre>

### Show notification

This export will show a notification to the player if the player owns a phone:

```lua
-- source: number
-- title: string
-- text: string
-- time: number
-- img: string
-- sound: string

exports["nPhone"]:ShowNotification(source, title, text, time, icon, sound)
```

### Get phone PIN

This export will get the passcode of a phone:

```lua
-- phoneId: string
-- cb: function

exports["nPhone"]:GetPasscodeFromPhoneId(phoneId, function(passcode)
    print(passcode)
end)
```

### Get source account

This export will get the current player linked account:

```lua
-- source: number

local sourceAccount = exports["nPhone"]:GetSourceCurrentAccount(source)
```

### Send email

This export will send an email to an account:

```lua
-- from: string
-- subject: string
-- content: string
-- profileImg: string
-- to: string

exports["nPhone"]:SendEmail(from, subject, content, profileImg, to)
```

### Get phone call

This export will get the current phone call identifier:

```lua
-- phoneNumber: string

local callId = exports["nPhone"]:GetCall(phoneNumber)
```

### End phone call

This export will end the call:

```lua
-- callId: string

exports["nPhone"]:EndCall(callId)
```

### Is in call

This export will get the phone call status:

```lua
-- phoneNumber: string

local callStatus = exports["nPhone"]:IsInCall(phoneNumber)
```

## Server Events

### Message event

It will be triggered when a text message is sent:

```lua
RegisterNetEvent('nPhone:messageTrigger', function(chat, phone, message, messageId, attachments)
    print(chat, phone, message, messageId, attachments)
end)
```
