# Exports

## Lua code examples for Client Side

```lua
local phoneIsUseNow = exports["sfphone"]:phoneIsUseNow()
print(phoneIsUseNow) -- return true or false
```

```lua
local mycgroup = exports["sfphone"]:cgroupPlayer()
if mycgroup > 0 then
    print("Your id group is "..mycgroup)
else
    print("You havent a group")
end
```

Use if the phone stops working

```lua
TriggerEvent("nuifix") -- if the NUI breaks.
```

## Lua code examples for Server Side

```lua
local src = source 
exports["sfphone"]:createCgroup(src) -- creates a group in cGroups app
```

```lua
local id_group = 5 -- for e.g
exports["sfphone"]:removeCgroup(id_group) -- remove a group in cGroups app
```

If you want to block the SIM card and make a duplicate

```lua
local src = source 
exports["sfphone"]:openMenuResetSim(src)
```

If you want to install apps on your phone with an external script

<pre class="language-lua"><code class="lang-lua">local src = source 
<strong>local applicationName = "cgroups" -- support "aparat", "gallery", "bank", "appstore",
</strong><strong>-- "news", "notes", "advertising", "twitter", "walletc", "cgroups", "racing"
</strong>local applicationPrice = 1000 -- 1000($), you can change to other number, 0 or false
<strong>exports["sfphone"]:installApp(src, applicationName, applicationPrice)
</strong></code></pre>

Example of sending SMS for players from other your scripts

```lua
local toNumberPhone = 12345 -- if the phone number is incorrect, you will receive a notify
local message = "Hello World" -- some text
local fromNumber = 1 -- example for ALERT in config.js 
local imgURL = nil -- some url for image, only formats .jpg .jpeg .png or set nil
exports["sfphone"]:sendNewMessageFromScript(toNumberPhone, message, fromNumber, imgURL)
```

As an administrator, you can create a sim card with any number you want

{% hint style="danger" %}
If you do not have permission this function will not work
{% endhint %}

<pre class="language-lua"><code class="lang-lua">local src = source 
<strong>local numberPhone = 123 -- if the phone number is unavailable, you will receive a notify
</strong>local sourceIdPlayer = 1 -- enter player ID server
exports["sfphone"]:createSimByAdmin(src, numberPhone, sourceIdPlayer)
</code></pre>

Example of sending SMS for group players from application cGroups

```lua
local fromNumber = 1 -- example for ALERT in config.js 
local idGroup = 5-- if you set 0 it will not work
local message = "Hello World" -- some text
local imgURL = "https://media.discordapp.net/attachments/947451128767987712/1010941186275545138/screenshot.jpg" -- some url for image, only formats .jpg .jpeg .png or set nil
exports["sfphone"]:sendNewMessageTocGroup(fromNumber, idGroup, message, imgURL)
```

Example of sending SMS for online players

```lua
local fromNumber = 1 -- example for ALERT in config.js 
local message = "Hello World" -- some text
local imgURL = "https://media.discordapp.net/attachments/947451128767987712/1010941186275545138/screenshot.jpg" -- some url for image, only formats .jpg .jpeg .png or set nil
exports["sfphone"]:sendNewMessageToOnline(fromNumber, message, imgURL)
```

Example of retrieving a player's current phone number

```lua
local src = source
exports["sfphone"]:getNumberFromSource(src)
```

Custom notification for player

```lua
local src = source
local time = 10 -- in seconds (notification display time)
local text = "Hello World" -- some text
exports["sfphone"]:customNotification(src, time, text)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scriptsfivem.com/resources/sfphone/exports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
