# FUNCTIONS

1. Check if phone is open

{% tabs %}
{% tab title="Client Side" %}

```lua
exports['piotreq_phone']:isOpen() -- true | false

LocalPlayer.state.PhoneOpen -- true | false
```

{% endtab %}

{% tab title="Server Side" %}

* playerId `number`

```lua
Player(playerId).state.PhoneOpen -- true | false
```

{% endtab %}
{% endtabs %}

2. Force close phone

{% tabs %}
{% tab title="Client Side" %}
This will instant close phone and also reject call if on call

```lua
exports['piotreq_phone']:ForceClosePhone()
```

{% endtab %}
{% endtabs %}

3. On open / close phone

{% tabs %}
{% tab title="Client Side" %}

* isActive `boolean`

```lua
AddEventHandler('piotreq_phone:isPhoneActive', function(isActive)
    print(isActive) -- true | false
end)
```

{% endtab %}
{% endtabs %}

4. On notify (only trigger if phone is closed)

{% tabs %}
{% tab title="Client Side" %}

* data  `table`
* px `number | string`

It will print number (position of phone in px used in translateY) if there is more than 1 notify left, otherwise it will print 'close'

```lua
AddEventHandler('piotreq_phone:isNotifyActive', function(data)
    print(data.px) -- number | string
end)
```

{% endtab %}
{% endtabs %}


---

# 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://piotreq-scripts.gitbook.io/piotreq-scripts/assets-and-guides/phone/functions.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.
