# Business with jobs

{% hint style="danger" %}
Please don't skip the tutorial parts, make sure to start here: [Business Update](https://documentation.rcore.cz/paid-resources/rcore_tattoos/business-update)
{% endhint %}

{% hint style="warning" %}
Only works with **ESX/QBCore**! For simple standalone business check [this](https://documentation.rcore.cz/paid-resources/rcore_tattoos/business-update/simple-business) :point\_left:
{% endhint %}

The biggest part of the update is of course a business with employees, customers, society management, minigame.. well let's just take a look!

### How to?

First of all, make sure to read [Simple Business](https://documentation.rcore.cz/paid-resources/rcore_tattoos/business-update/simple-business) section as it is a base for the complex business with jobs.

After completing what you read in Simple Business section, you should be left with a configured simple business. Let's now extend it to a fully working business.

From the Simple Business section, you should be left with something like this:

{% hint style="danger" %}
`businessName` is also used as society/job name for ESX and QBCore *(👉 more on QBCore at the end of this tutorial)*

* ESX: **(without the 'society\_' prefix!)**
* QBCore: same as job name employee will need to have and same thing you will put in jobs.lua (more at the bottom of the page)
  {% endhint %}

```lua
my_business = {
    enabled = true,
    businessName = "tattoobusiness",
    owner = "",
    bossMenu = {
        pos   = vector3(1862.2, 3748.2, 33),
        size  = vector3(1, 1, 1),
        color = {r=255, g=255, b=255, a=255},
        markerLabel = '💼'
    },
}
```

Now, we will add a job into it like this:

```lua
my_business = {
    enabled = true,
    ...
    bossMenu = {
        ...
    },
    job = {
        -- here we will add all the settings below
    }
}
```

### Config Structure

```lua
job = {
    enabled = true,
    label= "Tattoo shop",
    employeeMarkerLabel = "🖌",
    customerAnim = {
        sitting = {
            pos = vector4(1864.0, 3746.6, 33.2, 0),
            animName = 'ig_5_p3_base',
            animDict = 'timetable@ron@ig_5_p3',
        },
    },
    employeeAnim = {
        idle = {
            pos = vector3(1863.34, 3746.0, 33),
            animName = '_idle_a',
            animDict = 'random@shop_tattoo',
        },
        tattoo = {
            animName = 'machinic_loop_mechandplayer',
            animDict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
        },
    },
    grades = {
        {
            name = 'novice',
        },
        {
            name = 'artist',
        },
        {
            name = 'boss',
            isBoss = true,
        },
    },
    bossmenuOptions = {
        withdraw = true,
        deposit = true,
        wash = false,
        employees = true,
        grades = true,
    },
},
```

Looks complicated? Let's break it down!

* `enabled`
  * `true/false`if the job part should be enabled or not
* `label`
  * only used in *addon\_account* table in database
* `employeeMarkerLabel`
  * Label to be shown at a place where employee enters the customers tattoo session
  * default is :paintbrush:, but you can use text and other emojis
* `customerAnim`
  * `sitting`
    * animation of the customer being tattooed
    * `pos`= [vector4](https://docs.fivem.net/docs/scripting-reference/runtimes/lua/functions/vector4/) position where player will sit when being tattooed (x,y,z and heading)
    * `animName`= animation name
    * `animDict`= animation directory
    * animName and animDict should be left as default, but you can edit it if you want (animation list [here](https://alexguirre.github.io/animations-list/))
* `employeeAnim`
  * `idle`
    * animation of employee waiting for customer while they choose tattoo
    * `pos`= vector3 position where player should stand while idling (will automatically look at customer, no need for heading)
    * *animName/animDict - same as in customerAnim*
  * `tattoo`
    * animation of employee tattooing customer
    * `pos` not needed, used one from idle animation
    * *animName/animDict - same as in customerAnim*
* `grades`
  * for now only boss grade is important as it is used for opening bossmenu etc. (another use may come in future update)
  * grade settings:
    * `name`= name of the job grade from database
    * `isBoss` = `true/false` if this grade should open bossmenu etc.
* `bossmenuOptions`
  * If you have ESX, you can configure bossmenu options for each business so you can for example have one illegal business that can wash money
  * data structure:
    * `withdraw` = money withdrawal from bossmenu, default `true`
    * `deposit` = money deposit from bossmenu, default `true`
    * `wash` = washing money option in bossmenu, default `false`
    * `employees` = employee management option, default `true`
    * `grades` = grade management option, default `true`

### QBCore jobs.lua

If you have qbcore, you also need to add the new job to jobs.lua, usually located in `qb-core/shared/jobs.lua`.

Make sure to also read notes below the code. The job in there will need to have same data as you have in config\_business.lua and will look something like this (data are taken from config above):

```lua
['tattoobusiness'] = { -- the businessName from config_business.lua
    label = 'Tattoo business',
    defaultDuty = true,
    offDutyPay = false,
    grades = { -- names must be same as in config_business.lua
        ['0'] = {
            name = 'novice',
            payment = 50
        },
        ['1'] = {
            name = 'artist',
            payment = 50
        },
        ['2'] = {
            name = 'boss',
            payment = 50,
            isboss = true -- see notes below
        },
    },
},
```

**❗ Few things to be careful about:**

* `['tattoobusiness'] = {` - value in here is the `businessName` from *config\_business.lua*
* grades need to be in the same order as in config\_business
* grades need to have exact same names as in *config\_business.lua* *(lowercase/uppercase too)*
* `isboss` needs to be set for boss grade in jobs.lua
  * also notice that it is `isBoss` in our config\_business, don't mix that up

\\

🎉 **If you did everything right, you should now have a working complex business! Now go make that moneeeey!** 💰
