# Events & Commands

## Phone notifications

The JPR Phone System contains a wide variety of notifications, all original notifications are processed by itself, nothing needs to be done, but if you want to send a custom notification, you can do so by following the example below.

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

```lua
TriggerEvent("jpr-phonesystem:client:customnotification", {
    app = "Custom", -- dont change
    title = "Custom Notification",
    img = "imagem.png",
    text = "Im a custom notification",
    time = 2600,
})
```

{% endtab %}

{% tab title="Server side" %}

```lua
TriggerClientEvent("jpr-phonesystem:client:customnotification", source, {
    app = "Custom", -- dont change
    title = "Custom Notification",
    img = "imagem.png",
    text = "Im a custom notification",
    time = 2600,
})
```

{% endtab %}
{% endtabs %}

## Phone wallet logs

The JPR Phone System contains a wallet app where you can see all your transactions made.\
This is our trigger to add a new log on wallet app:

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

```lua
TriggerServerEvent("jpr-phonesystem:server:createNewWalletLog", AMOUNT, TYPE, NOTIFICATION)
```

\
AMOUNT = Amount of the transaction made\
TYPE = Should be **0** or **1** ( 0 = **Deposit**, 1 = **Withdraw** )\
NOTIFICATION = true or false ( true = Player receive notification on phone, false = No notification)
{% endtab %}

{% tab title="Server side" %}

```lua
TriggerEvent("jpr-phonesystem:server:createNewWalletLog", AMOUNT, TYPE, NOTIFICATION, SOURCE)
```

SOURCE = Should be player source id\
AMOUNT = Amount of the transaction made\
TYPE = Should be **0** or **1** ( 0 = **Deposit**, 1 = **Withdraw** )\
NOTIFICATION = true or false ( true = Player receive notification on phone, false = No notification)
{% endtab %}
{% endtabs %}

## Phone mails

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

```lua
TriggerServerEvent('jpr-phonesystem:server:sendEmail', {
   subject = "Phone System", -- Subject
   message = "Hello, nice phone sir!", -- Content
   sender = "jpresources.client.fivem@gmail.com", -- Submitted by
   event = {type = "client", event = "jpr-phonesystem:example", buttonData = {}}, -- Optional 
})
```

If you don't want the email to trigger some kind of event, leave it like this

```lua
TriggerServerEvent('jpr-phonesystem:server:sendEmail', {
   subject = "Phone System", -- Subject
   message = "Hello, nice phone sir!", -- Content
   sender = "jpresources.client.fivem@gmail.com", -- Submitted by
   event = {}, -- Optional 
})
```

{% endtab %}

{% tab title="Server side" %}

```lua
TriggerEvent('jpr-phonesystem:server:sendEmail', {
   subject = "Phone System", -- Subject
   message = "Hello, nice phone sir!", -- Content
   sender = "jpresources.client.fivem@gmail.com", -- Submitted by
   event = {type = "client", event = "jpr-phonesystem:example", buttonData = {}}, -- Optional 
}, source)
```

If you don't want the email to trigger some kind of event, leave it like this

```lua
TriggerEvent('jpr-phonesystem:server:sendEmail', {
   subject = "Phone System", -- Subject
   message = "Hello, nice phone sir!", -- Content
   sender = "jpresources.client.fivem@gmail.com", -- Submitted by
   event = {}, -- Optional 
}, source)
```

For sending emails to specific citizenid:

```lua
local citizenID = "CTN123FA"
local mailData = { 
    sender = 'Township', 
    subject = 'Driving lessons request', 
    message = 'My custom message',
    button = {} 
} 

exports['jpr-phonesystem']:sendNewMailToOffline(citizenID, mailData)
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Offline or not, the player will receive the email.
{% endhint %}

## Verified Share It ( Instagram ) command

The JPR Phone System allows you to add verified to some player's share it profile, you can edit the name of the command in the `config.lua`.

Its syntax should be as follows:\
`/(name of command) (account id) (true or false)` \
**True** - Add verified\
**False** - Remove verified\
\
In-Game example:\
`/verifiedInstagram 65qHj7UZ408UfCU true`

### Where can i find Account ID?

You can find Account ID in the discord webhook channel or in SQL Table: `jpr_phonesystem_instagram_accounts`

{% hint style="danger" %}
**Account ID** is NOT **Game ID**
{% endhint %}

## Verified Catiter ( Twitter ) command

The JPR Phone System allows you to add verified to some player's catiter profile, you can edit the name of the command in the `config.lua`.

Its syntax should be as follows:\
`/(name of command) (account id) (true or false)` \
**True** - Add verified\
**False** - Remove verified\
\
In-Game example:\
`/verifiedTwitter 65qHj7UZ408UfCU true`

### Where can i find Account ID?

You can find Account ID in the discord webhook channel or in SQL Table: `jpr_phonesystem_tweet_accounts`

{% hint style="danger" %}
**Account ID** is NOT **Game ID**
{% endhint %}

## Verified TikTrend ( Tiktok ) command

The JPR Phone System allows you to add verified to some player's tiktrend profile, you can edit the name of the command in the `config.lua`.

Its syntax should be as follows:\
`/(name of command) (account id) (true or false)` \
**True** - Add verified\
**False** - Remove verified\
\
In-Game example:\
`/verifiedTiktok 65qHj7UZ408UfCU true`

### Where can i find Account ID?

You can find Account ID in the discord webhook channel or in SQL Table: `jpr_phonesystem_tiktok_accounts`

{% hint style="danger" %}
**Account ID** is NOT **Game ID**
{% endhint %}

## Billing command

You can change command name going to `config.lua` in `Config.BillingCommand`\
**Example**:

`/sendbill ID Amount`\
`/sendbill 1 500`

{% hint style="info" %}
You can change all command details in `server_config.lua` file.
{% endhint %}

## NPC events

To repair battery:&#x20;

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

```lua
TriggerEvent('jpr-phonesystem:client:fixPhone')
```

{% endtab %}

{% tab title="Server side" %}

```lua
TriggerClientEvent('jpr-phonesystem:client:fixPhone', source)
```

{% endtab %}
{% endtabs %}

To hack phones:

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

```lua
TriggerEvent('jpr-phonesystem:client:hackPhone')
```

{% endtab %}

{% tab title="Server side" %}

```lua
TriggerClientEvent('jpr-phonesystem:client:hackPhone', source)
```

{% endtab %}
{% endtabs %}

## Exports List

### Is Phone Open

Will return true of false, depending of opening state of phone.

```lua
exports['jpr-phonesystem']:isPhoneOpen()  --- return true or false
```

### Close Phone

Will give you the hability to close Phone System via code.

```lua
exports['jpr-phonesystem']:closePhone()  --- return true or false
```

### Open Phone

Will give you the hability to open Phone System via code.

```lua
exports['jpr-phonesystem']:openPhone()
```

### Is Camara Open

Will return true of false, depending of opening state of camera.

```lua
exports['jpr-phonesystem']:isCamaraOpen()  --- return true or false
```

### Get Phone Number

Will return the current player phone number.

```lua
exports['jpr-phonesystem']:getPhoneNumber() --- 96847392
```

### Send Whatsapp

Will send a message to the selected player to whatsapp.

Template:

```lua
exports['jpr-phonesystem']:sendWhatsapp(Receiver Number, Sender Number (Can be a name), Message, Type)
```

**Receiver** should be the number of player you want to contact;\
**Sender Number** can be anything, even a name;\
**Message** is what you want to send to player;

\
**Type** is the type of message:\
\- "message" - Will send a normal text message;\
\- "gps" - Will send a GPS message (on Message field you need to send the coords);\
\- "image" - Will send a image message (on Message field you need to send a link);

Example:

```lua
exports['jpr-phonesystem']:sendWhatsapp("7142903207", "export testing", "export test", "message")
```

### Send iMessage

Will send a message to the selected player to iMessage.

Template:

```lua
exports['jpr-phonesystem']:sendiMessage(Receiver Number, Sender Number (Can be a name), Message, Type)
```

**Receiver** should be the number of player you want to contact;\
**Sender Number** can be anything, even a name;\
**Message** is what you want to send to player;

\
**Type** is the type of message:\
\- "message" - Will send a normal text message;\
\- "gps" - Will send a GPS message (on Message field you need to send the coords);\
\- "image" - Will send a image message (on Message field you need to send a link);

Example:

```lua
exports['jpr-phonesystem']:sendiMessage("7142903207", "export testing", "export test", "message")
```

{% hint style="danger" %}
All this exports are **CLIENT SIDED**
{% endhint %}

## Distress Signal

To send a distress signal, use this trigger:

{% tabs %}
{% tab title="Client Side" %}
"ambulance" - Means your ambulance job tag\
"Distress Signal received, please help the citizen!" - Is the message that player will receive

```lua
TriggerEvent("jpr-phonesystem:client:sendDistressSignal", "ambulance", "Distress Signal received, please help the citizen!")
```

{% endtab %}

{% tab title="Server Side" %}
"ambulance" - Means your ambulance job tag\
"Distress Signal received, please help the citizen!" - Is the message that player will receive

```lua
TriggerClientEvent("jpr-phonesystem:client:sendDistressSignal", source, "ambulance", "Distress Signal received, please help the citizen!")
```

{% 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://joaos-organization-3.gitbook.io/jpresources-documentation/installation/phone-system/events-and-commands.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.
