# Installations

## Step 1 ➡ Dependencies&#x20;

This is one of the most important parts, since without the dependencies, the resource will never work or not start, here we will list the dependencies with their respective links for you to download and add them to your server.

{% embed url="<https://github.com/overextended/oxmysql>" %}

{% embed url="<https://github.com/citizenfx/screenshot-basic>" %}

{% embed url="<https://github.com/Xogy/xsound>" %}
If you use another script, you can configure it in server\_editable.lua (need only for radio app)
{% endembed %}

## Step 2 ➡ Resources in server.cfg

{% hint style="warning" %}
if you are using ESX ➡ NEVER, but NEVER, you must place the resources above `es_extended`, if you do this they will never work and will throw errors
{% endhint %}

The correct order of the resources is as follows, always keeping <mark style="color:orange;">es\_extended</mark> and its cores above, but the other normal resources below

```
ensure screenshot-basic
ensure xsound
ensure sfphone
```

{% hint style="danger" %}
if you are using **QBCore** framework remove the **qb-phone** resource
{% endhint %}

## Step 3 ➡ Database

Run query/SQL query and paste below code

{% code fullWidth="false" %}

```sql
DROP TABLE IF EXISTS `phone_advertising`;
DROP TABLE IF EXISTS `phone_callhistory`;
DROP TABLE IF EXISTS `phone_cgroups`;
DROP TABLE IF EXISTS `phone_contacts`;
DROP TABLE IF EXISTS `phone_gallery`;
DROP TABLE IF EXISTS `phone_messages`;
DROP TABLE IF EXISTS `phone_news`;
DROP TABLE IF EXISTS `phone_settings`;
DROP TABLE IF EXISTS `phone_sim`;
DROP TABLE IF EXISTS `phone_twitter_accounts`;
DROP TABLE IF EXISTS `phone_twitter_likes`;
DROP TABLE IF EXISTS `phone_twitter_tweets`;
DROP TABLE IF EXISTS `phone_twitter_tweets_deleted`;
DROP TABLE IF EXISTS `phone_love_accounts`;
DROP TABLE IF EXISTS `phone_love_likes`;
DROP TABLE IF EXISTS `phone_love_messages`;
DROP TABLE IF EXISTS `phone_darkchat_chats`;
DROP TABLE IF EXISTS `phone_darkchat_accounts`;

CREATE TABLE `phone_advertising` (
  `id` int(11) NOT NULL,
  `number` int(11) NOT NULL,
  `description` text NOT NULL,
  `url` varchar(256) DEFAULT NULL,
  `date` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_callhistory` (
  `id` int(11) NOT NULL,
  `accept` varchar(2) NOT NULL DEFAULT '0',
  `number` int(11) DEFAULT NULL,
  `fromnumber` int(11) NOT NULL,
  `tonumber` int(11) NOT NULL,
  `date` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_cgroups` (
  `id` int(11) NOT NULL,
  `idgroup` int(11) NOT NULL,
  `cid` varchar(64) NOT NULL,
  `lider` int(11) NOT NULL DEFAULT 0,
  `idserver` int(11) NOT NULL,
  `namesurname` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_contacts` (
  `id` int(11) NOT NULL,
  `number` int(11) DEFAULT NULL,
  `name` varchar(64) DEFAULT NULL,
  `namenumber` int(11) DEFAULT NULL,
  `nameurl` varchar(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_gallery` (
  `id` int(11) NOT NULL,
  `number` int(11) NOT NULL,
  `url` varchar(256) NOT NULL,
  `date` varchar(64) NOT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_messages` (
  `id` int(11) NOT NULL,
  `number` int(11) NOT NULL,
  `readed` varchar(2) NOT NULL DEFAULT '0',
  `fromnumber` int(11) NOT NULL,
  `tonumber` int(11) NOT NULL,
  `message` text NOT NULL,
  `date` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_news` (
  `id` int(11) NOT NULL,
  `title` varchar(128) NOT NULL,
  `text` text NOT NULL,
  `img` text NOT NULL,
  `namesurname` varchar(128) NOT NULL,
  `data` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_settings` (
  `id` int(11) NOT NULL,
  `cid` varchar(64) NOT NULL,
  `background` int(11) NOT NULL DEFAULT 1,
  `backgroundurl` varchar(255) DEFAULT NULL,
  `sound` float NOT NULL DEFAULT 0.15,
  `vibrations` int(11) NOT NULL DEFAULT 0,
  `brightness` float NOT NULL DEFAULT 1,
  `size` float NOT NULL DEFAULT 0,
  `notify_twitter` int(2) NOT NULL DEFAULT 1,
  `notify_sms` int(2) NOT NULL DEFAULT 1,
  `notify_love` int(2) NOT NULL DEFAULT 1,
  `notify_darkchat` int(2) NOT NULL DEFAULT 1,
  `notify_mechanic` int(2) NOT NULL DEFAULT 1,
  `darkmode` int(2) NOT NULL DEFAULT 0,
  `streamermode` int(2) NOT NULL DEFAULT 0,
  `blockednumbers` text NOT NULL DEFAULT('[]'),
  `notes` text DEFAULT NULL,
  `apps` text NOT NULL DEFAULT('[]'),
  `ringtone` varchar(256) DEFAULT 'phone_ringtone.mp3',
  `ringtone_notify` varchar(512) DEFAULT 'phone_notification.mp3'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_sim` (
  `id` int(11) NOT NULL,
  `cid` varchar(64) NOT NULL,
  `number` int(11) NOT NULL,
  `active` int(11) NOT NULL DEFAULT 0,
  `duplicat` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_twitter_accounts` (
  `id` int(11) NOT NULL,
  `cid` varchar(64) NOT NULL,
  `nowlogged` varchar(64) NOT NULL,
  `number` int(11) NOT NULL,
  `username` varchar(32) NOT NULL,
  `password` varchar(64) NOT NULL,
  `avatar` varchar(256) DEFAULT NULL,
  `likes` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_twitter_likes` (
  `id` int(11) NOT NULL,
  `id_tweet` int(11) NOT NULL,
  `username` varchar(64) NOT NULL,
  `liked` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_twitter_tweets` (
  `id` int(11) NOT NULL,
  `username` varchar(64) NOT NULL,
  `message` mediumtext NOT NULL,
  `image` varchar(256) DEFAULT NULL,
  `likes` int(11) NOT NULL DEFAULT 0,
  `date` varchar(32) NOT NULL,
  `avatar` varchar(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_twitter_tweets_deleted` (
  `id` int(11) NOT NULL,
  `username` varchar(64) NOT NULL,
  `message` mediumtext NOT NULL,
  `image` varchar(256) DEFAULT NULL,
  `likes` int(11) NOT NULL DEFAULT 0,
  `date` varchar(32) NOT NULL,
  `avatar` varchar(256) DEFAULT NULL,
  `admin` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_love_accounts` (
  `id` int(11) NOT NULL,
  `cid` varchar(64) NOT NULL,
  `nowlogged` varchar(64) DEFAULT NULL,
  `number` int(11) NOT NULL,
  `username` varchar(32) NOT NULL,
  `name` varchar(64) NOT NULL,
  `password` varchar(64) NOT NULL,
  `description` varchar(512) DEFAULT NULL,
  `photos` text DEFAULT NULL,
  `settings` varchar(96) NOT NULL DEFAULT '{"age":18,"sex":"m","lookingfor":"w"}'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_love_likes` (
  `id` int(11) NOT NULL,
  `fromaccount` varchar(64) NOT NULL,
  `toaccount` varchar(64) NOT NULL,
  `fromlike` int(2) NOT NULL,
  `tolike` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_love_messages` (
  `id` int(11) NOT NULL,
  `account` varchar(64) NOT NULL,
  `readed` varchar(2) NOT NULL DEFAULT '0',
  `fromaccount` varchar(64) NOT NULL,
  `toaccount` varchar(64) NOT NULL,
  `message` text NOT NULL,
  `date` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_darkchat_accounts` (
  `id` int(11) NOT NULL,
  `cid` varchar(64) NOT NULL,
  `username` varchar(32) NOT NULL,
  `chats` text NOT NULL DEFAULT('[]')
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_darkchat_chats` (
  `id` int(11) NOT NULL,
  `name` varchar(64) NOT NULL,
  `owner` varchar(64) DEFAULT NULL,
  `players` text NOT NULL DEFAULT('[]'),
  `invitecode` varchar(64) NOT NULL,
  `messages` longtext NOT NULL DEFAULT('[]'),
  `date` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `phone_photostory_accounts` (
  `id` int(11) NOT NULL,
  `owner` varchar(46) DEFAULT NULL,
  `nowlogged` varchar(64) NOT NULL,
  `password` varchar(32) NOT NULL,
  `account` varchar(32) NOT NULL,
  `name` varchar(32) NOT NULL,
  `description` varchar(256) DEFAULT NULL,
  `avatar` text DEFAULT NULL,
  `follow` int(8) NOT NULL DEFAULT 0,
  `followers` int(8) NOT NULL DEFAULT 0,
  `likes` text NOT NULL,
  `follows` text NOT NULL,
  `notifications` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `phone_photostory_posts` (
  `idpost` int(11) NOT NULL,
  `account` varchar(32) NOT NULL,
  `description` varchar(256) NOT NULL,
  `image` varchar(512) NOT NULL,
  `comments` longtext NOT NULL,
  `likes` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

ALTER TABLE `phone_advertising` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_callhistory` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_cgroups` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_contacts` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_gallery` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_messages` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_news` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_settings` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_sim` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_twitter_accounts` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_twitter_likes` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_twitter_tweets` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_twitter_tweets_deleted` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_love_accounts` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_love_likes` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_love_messages` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_darkchat_accounts` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_darkchat_chats` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_photostory_accounts` ADD PRIMARY KEY (`id`);
ALTER TABLE `phone_photostory_posts` ADD PRIMARY KEY (`idpost`);
ALTER TABLE `phone_advertising` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_callhistory` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_cgroups` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_contacts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_gallery` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_messages` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_news` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_settings` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_sim` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_twitter_accounts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_twitter_likes` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_twitter_tweets` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_twitter_tweets_deleted` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_love_accounts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_love_likes` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_love_messages` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_darkchat_accounts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_darkchat_chats` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_photostory_accounts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `phone_photostory_posts` MODIFY `idpost` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
```

{% endcode %}

{% hint style="danger" %}
The last step is to modify the player data table. <mark style="color:red;">Important!</mark> Use the code for your engine.
{% endhint %}

{% tabs %}
{% tab title="ESX" %}

```sql
UPDATE `users` SET `phone_number`=0;
ALTER TABLE `users` MODIFY `phone_number` INT(16) DEFAULT 0;
UPDATE `users` SET `phone_number`=0;
```

{% endtab %}

{% tab title="QB-CORE" %}

```sql
ALTER TABLE `players` ADD `phone_number` INT(16) DEFAULT 0;
```

{% endtab %}

{% tab title="Your framework" %}

```sql
ALTER TABLE `YOUR_TABLE_WITH_PLAYER_DATA` ADD `phone_number` INT(16) DEFAULT 0;
```

{% endtab %}
{% endtabs %}

## Step 4 ➡ Click on [Config](https://docs.scriptsfivem.com/resources/sfphone/config)&#x20;
