# QBCore

## Download Resource

You will receive the script in [`keymaster.fivem.net`](https://keymaster.fivem.net/asset-grants) profile, after this click in blue "download" button.

After download, put the script in your server files.

{% hint style="warning" %}
Remeber:

You need to be logged with the same cfx.re account you used to buy in my tebex store.
{% endhint %}

## Dependencies Part

* [**qb-core**](https://github.com/qbcore-framework/qb-core)
* [**qb-policejob**](https://github.com/qbcore-framework/qb-policejob)&#x20;
* [**qb-crypto**](https://github.com/qbcore-framework/qb-crypto)&#x20;
* [**qb-lapraces**](https://github.com/qbcore-framework/qb-lapraces)&#x20;
* [**qb-houses**](https://github.com/qbcore-framework/qb-houses)&#x20;
* [**qb-garages**](https://github.com/qbcore-framework/qb-garages) **or your garage script who uses (player\_vehicles)**
* [**qb-banking**](https://github.com/qbcore-framework/qb-banking)&#x20;
* [**screenshot-basic**](https://github.com/citizenfx/screenshot-basic)&#x20;

Download all the scripts by clicking on their respective names, put them in the server files and start server.cfg

## Webhooks

Budget Phone uses webhooks for photo system.\
All you need to do is replace the default webhooks, via config.lua

<figure><img src="https://3317815405-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAcw6nAW8IGe15skCfMoj%2Fuploads%2FwL3xbFCG3mZMWmFVzG0w%2FCaptura%20de%20ecr%C3%A3%202022-12-22%20182655.png?alt=media&#x26;token=4c60ed3e-b375-4231-a056-2bb9afe0026c" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
For more info how to create a discord webhook follow this tutorial:\
<https://www.youtube.com/watch?v=fKksxz2Gdnc&t=7s&ab_channel=NoIntroTutorials>
{% endhint %}

## SQL

First, execute this code in SQL to delete all old SQL:

```
DROP TABLE IF EXISTS `crypto_transactions`;
DROP TABLE IF EXISTS `phone_extras`;
DROP TABLE IF EXISTS `phone_gallery`;
DROP TABLE IF EXISTS `phone_grupos`;
DROP TABLE IF EXISTS `phone_invoices`;
DROP TABLE IF EXISTS `phone_messages`;
DROP TABLE IF EXISTS `phone_olx`;
DROP TABLE IF EXISTS `phone_tweets`;
DROP TABLE IF EXISTS `phone_tweets_hashtags`;
DROP TABLE IF EXISTS `phone_tweets_mention`;
DROP TABLE IF EXISTS `player_mails`;
```

{% hint style="danger" %}
This is mandatory to avoid errors
{% endhint %}

After this only need to execute SQL file attached to newphone folder.

## Setup interact-sound

Open interact-sound - client - sounds and drop all newphone 2.0 sounds.

## Config.lua

Setup all config.lua to your needs, read all comments in green color to be more easier.

## Garage event

if your qb-garages does not have the event "**qb-garage:server:GetPlayerVehicles**" add this to \
qb-garage/server.lua or any server side script:&#x20;

```lua
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.CreateCallback('qb-garages:server:GetPlayerVehicles', function(source, cb)
    local Player = QBCore.Functions.GetPlayer(source)
    local Vehicles = {}

    MySQL.rawExecute('SELECT * FROM player_vehicles WHERE citizenid = ?', { Player.PlayerData.citizenid }, function(result)
        if result[1] then
            for _, v in pairs(result) do
                local VehicleData = QBCore.Shared.Vehicles[v.vehicle]

                local VehicleGarage = "No garage"
                if v.garage ~= nil then
                    if v.garage ~= nil then
                        VehicleGarage = v.garage
                    else
                        VehicleGarage = "House garage"
                    end
                end

                local stateTranslation
                if v.state == 0 then
                    stateTranslation = "Out"
                elseif v.state == 1 then
                    stateTranslation = "Garaged"
                elseif v.state == 2 then
                    stateTranslation = "Impound"
                end

                local fullname
                if VehicleData and VehicleData['brand'] then
                    fullname = VehicleData['brand'] .. ' ' .. VehicleData['name']
                else
                    fullname = VehicleData and VehicleData['name'] or 'Unknown Vehicle'
                end

                Vehicles[#Vehicles + 1] = {
                    fullname = fullname,
                    brand = VehicleData and VehicleData['brand'] or '',
                    model = VehicleData and VehicleData['name'] or '',
                    plate = v.plate,
                    garage = VehicleGarage,
                    state = stateTranslation,
                    fuel = v.fuel,
                    engine = v.engine,
                    body = v.body
                }
            end
            cb(Vehicles)
        else
            cb(nil)
        end
    end)
end)
```

## Compatibility and working emails

Replace all **qb-phone** events in server files and change it to **jpr-newphone.**

{% hint style="warning" %}
If email system dont work for you, please replace your trigger to this one:\
**jpr-newphone:server:sendNewMailFix**
{% endhint %}

{% hint style="success" %}
You are good to go!\
Any question open a ticket in my discord server.
{% endhint %}

<figure><img src="https://3317815405-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAcw6nAW8IGe15skCfMoj%2Fuploads%2FQKhnV2T4xlSjEyjovjeN%2FBudget%20Phone.jpg?alt=media&#x26;token=9c08bf7c-8793-4c2e-ba11-10cde7347c19" alt=""><figcaption></figcaption></figure>
