# Installation

{% hint style="danger" %}
Please go through each step carefully and allow enough time. Support tickets opened due to simple errors will be forwarded to the documentation.
{% endhint %}

### 1. Insert the .sql file to your database

***

### 2. Install dependencys

* [NativeUI](https://github.com/FrazzIe/NativeUILua)

***

### 3. Framework changes

#### QB-Framework

{% tabs %}
{% tab title="QB" %}
{% hint style="info" %}
To make everything work with QB-Core you have to add a function to qb-core.\
Include it after "function self.Functions.SetPlayerData(key, val)" in Line 257.
{% endhint %}

{% code title="qb-core/server/player.lua" %}

```lua
function self.Functions.SetPhoneNumber(val)
    self.PlayerData.charinfo.phone = val
    self.Functions.UpdatePlayerData()
end
```

{% endcode %}
{% endtab %}

{% tab title="ESX" %}
Nothing needs to be changes for ESX. 😄👍
{% endtab %}
{% endtabs %}

### 4. Restart your server

{% hint style="danger" %}
In order for your new asset to be recognized and the database changes to be applied, you must restart the server!
{% endhint %}

***

### 5. Smartphone changes

{% tabs %}
{% tab title="Chezza's phone" %}
Create a new folder in phone/apps/emergencyphone and copy the file sv\_changenumber.lua into it which can be found in the emergencyphone folder.
{% endtab %}

{% tab title="GKS Phone" %}
{% code title="In /client/clientAPI.lua add" %}

```lua
RegisterNetEvent("gksphone:changePhoneNumber")
AddEventHandler("gksphone:changePhoneNumber", function(newNumber)
  SendNUIMessage({event = 'updateMyPhoneNumber', myPhoneNumber = newNumber})
end)
```

{% endcode %}
{% endtab %}

{% tab title="Quasar-Smartphone" %}
{% hint style="danger" %}
Please use only one of the 2 variants!
{% endhint %}

#### Variant one:

In this variant, we used Quasar's workcalls. \
The advantage in this variant is that players can keep their private numbers and thus still receive private calls and messages.

So you have to set the corresponding numbers in the config of the qs-smartphone and set the Config.useQuasarWorkCalls to true in the emergencyphone.

#### Variant two:

In this variant, the number of a player is replaced by the control center number. Thus, no private messages or calls can be received!

* Download qs-base and qs-fakenumber DLC for qs-smartphone and install it\
  **If you have problems installing them, please ask the support of Quasar.** \
  **Those are not my scripts and I won't help you with it!**
* Config.useQuasarWorkCalls = false
* Remove any existing workcall from the config of qs-smartphone
  {% endtab %}

{% tab title="NPWD" %}
Add this code in *<mark style="color:orange;">**npwd\dist\game\server**</mark>* after line *<mark style="color:orange;">**57577**</mark>**.***

```javascript
exp5('setPhoneNumber', (src, newNumber) => {
    player_service_default.getPlayer(src).setPhoneNumber(newNumber)
    console.log(`Phonenumber was set to ${player._phoneNumber}`)
})
```

<figure><img src="/files/ScP0FtLsSxmHYZCKsFUz" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="ySeries" %}
{% hint style="danger" %}
IMPORTANT!
{% endhint %}

Due to the current limitation of ySeries phone, the control center numbers **MUST** have exactly the same format **as all other numbers**. If you have a prefix of 855 and a length (excluding prefix) of 6, every control center number must also be in this format.&#x20;

So for 911 -> 855000911 or any other number in this format!
{% 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://docs.gpscripts.dev/emergencyphone/installation.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.
